Messages in this thread Patch in this message | | | From | xypron.glpk@gmx ... | Subject | [PATCH 1/1] usbip/userspace/libsrc/names.c: memory leak | Date | Mon, 27 Jan 2014 23:29:48 +0100 |
| |
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
p is freed if NULL. p is leaked if second calloc fails.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> --- drivers/staging/usbip/userspace/libsrc/names.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/usbip/userspace/libsrc/names.c b/drivers/staging/usbip/userspace/libsrc/names.c index 3c8d28b..b2904e8 100644 --- a/drivers/staging/usbip/userspace/libsrc/names.c +++ b/drivers/staging/usbip/userspace/libsrc/names.c @@ -170,12 +170,12 @@ static void *my_malloc(size_t size) p = calloc(1, sizeof(struct pool)); if (!p) { - free(p); return NULL; } p->mem = calloc(1, size); if (!p->mem) + free(p); return NULL; p->next = pool_head; -- 1.7.10.4
| |