summaryrefslogtreecommitdiffstats
path: root/net/core/sock.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2005-04-20 07:41:54 +0200
committerDavid S. Miller <davem@davemloft.net>2005-04-20 07:41:54 +0200
commit88a66858253c57334a519a77187234867bc8605c (patch)
tree0ed43178152af4eff13943540aa7e4ec9f3658fb /net/core/sock.c
parent[NET]: skbuff: remove old NET_CALLER macro (diff)
downloadlinux-88a66858253c57334a519a77187234867bc8605c.tar.xz
linux-88a66858253c57334a519a77187234867bc8605c.zip
[SOCK]: on failure free the sock from the right place
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/sock.c')
-rw-r--r--net/core/sock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index f52c87a9268a..4df4fa3c5de0 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -641,7 +641,10 @@ struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it)
}
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);