Skip to content

Commit

Permalink
usbip/userspace/libsrc/names.c: memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Heinrich Schuchardt authored and Greg Kroah-Hartman committed Feb 7, 2014
1 parent 54de9af commit 2a7470d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/staging/usbip/userspace/libsrc/names.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2a7470d

Please sign in to comment.