slub: fix a possible memory leak

Memory allocated by kstrdup should be freed,
when kmalloc(kmem_size, GFP_KERNEL) is failed.

Acked-by: Christoph Lameter <cl@linux.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Joonsoo Kim <js1304@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Joonsoo Kim 2012-05-11 00:32:59 +09:00 committed by Pekka Enberg
parent 9fe496116e
commit 601d39d00c

View file

@ -3968,9 +3968,9 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size,
}
return s;
}
kfree(n);
kfree(s);
}
kfree(n);
err:
up_write(&slub_lock);