Re: [PATCH] fix memory leak in mm/slab.c::alloc_kmemlist() (try #3)

Christoph Lameter
2006-03-22T01:10:58Z

On Wed, 22 Mar 2006, Jesper Juhl wrote:

> --- linux-2.6.16-rc6-mm2-orig/mm/slab.c 2006-03-18 16:55:55.000000000 +0100
> +++ linux-2.6.16-rc6-mm2/mm/slab.c 2006-03-21 22:33:45.000000000 +0100
> @@ -3399,12 +3399,17 @@ EXPORT_SYMBOL_GPL(kmem_cache_name);
> static int alloc_kmemlist(struct kmem_cache *cachep)
> {
> int node;
> + int count = -1;

Count? One could simply go backwards on the node and undo all
allocations for present nodes. That may be much simpler.

while (node >= 0 && node_isset(node, node_online_map) {

....

node--;
}

> struct kmem_list3 *l3;
> - int err = 0;

Ok. err is removed sinc we never set it to a nonzero value.

> + struct array_cache *new;
> + struct array_cache **new_alien;

Ok. Also not checked.