Skip to content

Commit

Permalink
SUNRPC: destroy freshly allocated transport in case of sockaddr init …
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
Stanislav Kinsbursky authored and Trond Myklebust committed Nov 10, 2011
1 parent a6f498a commit 2aa1353
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/sunrpc/xprtsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2aa1353

Please sign in to comment.