Subject: [PATCH][SOCK] on failure free the sock from the right place

From: [email-masked] (Arnaldo Carvalho de Melo)
Date: Tue, 19 Apr 2005 01:59:14 -0300

Hi Dave,

	Please apply.

Best Regards,

- Arnaldo

------------------------------------------------------------------------

Author: acme
Date: 2005-04-19 01:53:49 -0300 (Tue, 19 Apr 2005)
New Revision: 68

Modified:
   trunk/net/core/sock.c
Log:
[SOCK] on failure free the sock from the right place

Signed-off-by: Arnaldo Carvalho de Melo <[email-masked]>
Signed-off-by: David S. Miller <[email-masked]>

Modified: trunk/net/core/sock.c
===================================================================
--- trunk/net/core/sock.c	2005-04-19 02:32:15 UTC (rev 67)
+++ trunk/net/core/sock.c	2005-04-19 04:53:49 UTC (rev 68)
@@ -642,7 +642,10 @@
 		}
 		
 		if (security_sk_alloc(sk, family, priority)) {
-			kmem_cache_free(slab, sk);
+			if (slab != NULL)
+				kmem_cache_free(slab, sk);
+			else
+				kfree(sk);
 			sk = NULL;
 		} else
 			__module_get(prot->owner);