Skip to content

Commit

Permalink
slub: fix a possible memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joonsoo Kim authored and Pekka Enberg committed May 16, 2012
1 parent 9fe4961 commit 601d39d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 601d39d

Please sign in to comment.