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 <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Stanislav Kinsbursky 2011-11-10 14:33:23 +03:00 committed by Trond Myklebust
parent a6f498a891
commit 2aa13531bb

View 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;