summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2014-01-28 21:16:46 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-07 11:08:46 -0800
commit2a7470d9ffe506ff895f4a27dcf3840cb3ea097f (patch)
treeacb64e430cf418eaca64786f63f373802341ca3c /drivers
parent54de9af9f0d7a91e898b6e02199be16dc26a4870 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/usbip/userspace/libsrc/names.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c
index 3c8d28b771e0..81ff8522405c 100644
--- a/drivers/staging/usbip/userspace/libsrc/names.c
+++ b/drivers/staging/usbip/userspace/libsrc/names.c
@@ -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;