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:
parent
54de9af9f0
commit
2a7470d9ff
|
@ -169,15 +169,15 @@ static void *my_malloc(size_t size)
|
||||||
struct pool *p;
|
struct pool *p;
|
||||||
|
|
||||||
p = calloc(1, sizeof(struct pool));
|
p = calloc(1, sizeof(struct pool));
|
||||||
if (!p) {
|
if (!p)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
p->mem = calloc(1, size);
|
||||||
|
if (!p->mem) {
|
||||||
free(p);
|
free(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->mem = calloc(1, size);
|
|
||||||
if (!p->mem)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p->next = pool_head;
|
p->next = pool_head;
|
||||||
pool_head = p;
|
pool_head = p;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue