Pavel Emelyanov 218ad12f42 [IPV4]: Fix memory leak in inet_hashtables.h when NUMA is on
The inet_ehash_locks_alloc() looks like this:

#ifdef CONFIG_NUMA
	if (size > PAGE_SIZE)
		x = vmalloc(...);
	else
#endif
		x = kmalloc(...);

Unlike it, the inet_ehash_locks_alloc() looks like this:

#ifdef CONFIG_NUMA
	if (size > PAGE_SIZE)
		vfree(x);
	else
#else
		kfree(x);
#endif

The error is obvious - if the NUMA is on and the size
is less than the PAGE_SIZE we leak the pointer (kfree is
inside the #else branch).

Compiler doesn't warn us because after the kfree(x) there's
a "x = NULL" assignment, so here's another (minor?) bug: we 
don't set x to NULL under certain circumstances.

Boring explanation, I know... Patch explains it better.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2007-11-26 20:23:31 +08:00
..
2007-10-26 03:56:43 -07:00
2007-10-10 16:53:11 -07:00
2007-10-10 16:53:56 -07:00
2007-11-02 08:47:06 +01:00
2007-10-10 16:51:28 -07:00
2007-10-15 12:26:42 -07:00
2007-11-10 22:01:15 -08:00
2007-10-07 23:44:17 -07:00
2007-10-10 16:51:28 -07:00
2007-11-18 18:48:08 -08:00
2007-10-10 16:47:46 -07:00