From 2aa13531bbbc6582874bedfcd853e1058b0fb4f9 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Thu, 10 Nov 2011 14:33:23 +0300 Subject: SUNRPC: destroy freshly allocated transport in case of sockaddr init error Otherwise we will leak xprt structure and struct net reference. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index d7f97ef..2d78d95 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -2530,8 +2530,10 @@ static struct rpc_xprt *xs_setup_xprt(struct xprt_create *args, int err; err = xs_init_anyaddr(args->dstaddr->sa_family, (struct sockaddr *)&new->srcaddr); - if (err != 0) + if (err != 0) { + xprt_free(xprt); return ERR_PTR(err); + } } return xprt; -- cgit v0.10.2