Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a7470d9 authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by Greg Kroah-Hartman
Browse files

usbip/userspace/libsrc/names.c: memory leak



revised patch

p is freed if NULL.
p is leaked if second calloc fails.

Signed-off-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 54de9af9
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;