[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1390940206-7256-1-git-send-email-xypron.glpk@gmx.de>
Date: Tue, 28 Jan 2014 21:16:46 +0100
From: xypron.glpk@....de
To: gregkh@...uxfoundation.org
Cc: xypron.glpk@....de, ly80toro@....cs.fau.de, ke42caxa@....cs.fau.de,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] usbip/userspace/libsrc/names.c: memory leak
From: Heinrich Schuchardt <xypron.glpk@....de>
revised patch
p is freed if NULL.
p is leaked if second calloc fails.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@....de>
---
drivers/staging/usbip/userspace/libsrc/names.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c
index 3c8d28b..81ff852 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;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists