1
0
Fork 0

fix possible alloca() scope problem in lock

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@282 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
Xuefer 2006-11-20 15:15:17 +00:00
parent b31a6c1faa
commit 1fb72afd44
1 changed files with 2 additions and 2 deletions

4
lock.c
View File

@ -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;