Bump. ----- Original Message ----- > From: "Mathieu Desnoyers" <[email protected]> > To: [email protected] > Cc: [email protected], "Mathieu Desnoyers" > <[email protected]> > Sent: Saturday, September 27, 2014 7:49:22 PM > Subject: [PATCH lttng-tools] Fix: FD leak in accept error handling > > *** CID 1241799: Resource leak (RESOURCE_LEAK) > /src/common/sessiond-comm/inet.c: 324 in lttcomm_accept_inet_sock() > 318 > 319 end: > 320 return new_sock; > 321 > 322 error: > 323 free(new_sock); > >>> CID 1241799: Resource leak (RESOURCE_LEAK) > >>> Handle variable "new_fd" going out of scope leaks the handle. > 324 return NULL; > 325 } > 326 > 327 /* > 328 * Make the socket listen using LTTNG_SESSIOND_COMM_MAX_LISTEN. > 329 */ > > Signed-off-by: Mathieu Desnoyers <[email protected]> > --- > src/common/sessiond-comm/inet.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/src/common/sessiond-comm/inet.c > b/src/common/sessiond-comm/inet.c > index cf06ecb..4e34ad0 100644 > --- a/src/common/sessiond-comm/inet.c > +++ b/src/common/sessiond-comm/inet.c > @@ -272,7 +272,7 @@ error_connect: > LTTNG_HIDDEN > struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock) > { > - int new_fd; > + int new_fd, closeret; > socklen_t len; > struct lttcomm_sock *new_sock; > unsigned long timeout; > @@ -305,10 +305,18 @@ struct lttcomm_sock *lttcomm_accept_inet_sock(struct > lttcomm_sock *sock) > > ret = lttcomm_setsockopt_rcv_timeout(new_fd, timeout); > if (ret) { > + closeret = close(new_fd); > + if (closeret) { > + PERROR("close"); > + } > goto error; > } > ret = lttcomm_setsockopt_snd_timeout(new_fd, timeout); > if (ret) { > + closeret = close(new_fd); > + if (closeret) { > + PERROR("close"); > + } > goto error; > } > } > -- > 2.1.0 > >
-- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
