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,15 +169,15 @@ static void *my_malloc(size_t size) struct pool *p; p = calloc(1, sizeof(struct pool)); - if (!p) { + if (!p) + return NULL; + + p->mem = calloc(1, size); + if (!p->mem) { free(p); return NULL; } - p->mem = calloc(1, size); - if (!p->mem) - return NULL; - p->next = pool_head; pool_head = p;