提交 2a7470d9 编写于 作者: H Heinrich Schuchardt 提交者: Greg Kroah-Hartman

usbip/userspace/libsrc/names.c: memory leak

revised patch

p is freed if NULL.
p is leaked if second calloc fails.
Signed-off-by: NHeinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 54de9af9
......@@ -169,14 +169,14 @@ static void *my_malloc(size_t size)
struct pool *p;
p = calloc(1, sizeof(struct pool));
if (!p) {
free(p);
if (!p)
return NULL;
}
p->mem = calloc(1, size);
if (!p->mem)
if (!p->mem) {
free(p);
return NULL;
}
p->next = pool_head;
pool_head = p;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册