SUNRPC: destroy freshly allocated transport in case of sockaddr init error
authorStanislav Kinsbursky <skinsbursky@parallels.com>
Thu, 10 Nov 2011 11:33:23 +0000 (14:33 +0300)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 10 Nov 2011 19:50:07 +0000 (14:50 -0500)
Otherwise we will leak xprt structure and struct net reference.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
net/sunrpc/xprtsock.c

index d7f97ef265904f0ddc0d691360f1e920dc63210b..2d78d95955ab5474172ac406a853bc12fff0bea8 100644 (file)
@@ -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;