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

revised patch

p is freed if NULL.
p is leaked if second calloc fails.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Heinrich Schuchardt 2014-01-28 21:16:46 +01:00 committed by Greg Kroah-Hartman
parent 54de9af9f0
commit 2a7470d9ff
1 changed files with 5 additions and 5 deletions

View File

@ -169,15 +169,15 @@ static void *my_malloc(size_t size)
struct pool *p;
p = calloc(1, sizeof(struct pool));
if (!p) {
if (!p)
return NULL;
p->mem = calloc(1, size);
if (!p->mem) {
free(p);
return NULL;
}
p->mem = calloc(1, size);
if (!p->mem)
return NULL;
p->next = pool_head;
pool_head = p;