Commit 2a7470d9 authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by 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: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 54de9af9
...@@ -169,14 +169,14 @@ static void *my_malloc(size_t size) ...@@ -169,14 +169,14 @@ static void *my_malloc(size_t size)
struct pool *p; struct pool *p;
p = calloc(1, sizeof(struct pool)); p = calloc(1, sizeof(struct pool));
if (!p) { if (!p)
free(p);
return NULL; return NULL;
}
p->mem = calloc(1, size); p->mem = calloc(1, size);
if (!p->mem) if (!p->mem) {
free(p);
return NULL; return NULL;
}
p->next = pool_head; p->next = pool_head;
pool_head = p; pool_head = p;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment