Browse Source

fix possible alloca() scope problem in lock

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@282 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.2
Xuefer 15 years ago
parent
commit
1fb72afd44
  1. 4
      lock.c

4
lock.c

@ -91,7 +91,7 @@ xc_lock_t *xc_fcntl_init(const char *pathname) /* {{{ */
}
}
size = strlen(tmpdir) + sizeof("/.xcache.lock") - 1 + 3 * 10 + 100;
myname = do_alloca(size);
myname = malloc(size);
snprintf(myname, size - 1, "%s%c.xcache.%d.%d.%d.lock", tmpdir, DEFAULT_SLASH, (int) getuid(), i ++, rand());
pathname = myname;
}
@ -118,7 +118,7 @@ xc_lock_t *xc_fcntl_init(const char *pathname) /* {{{ */
}
if (myname) {
free_alloca(myname);
free(myname);
}
return lck;

Loading…
Cancel
Save