From: Mathieu Desnoyers Date: Sat, 10 Sep 2011 19:17:56 +0000 (-0700) Subject: ltt-sessiond: fix 2 double-unlock X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=b3c750d2ffae77322752a5b4f43bd4ddae3dfea6 ltt-sessiond: fix 2 double-unlock After a list iteration, the pointer is not null, so the unlock would trigger. The second path modified does 2 unlock when taking the if () branch. Signed-off-by: Mathieu Desnoyers --- diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index 77497d570..094fe4adf 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -609,7 +609,7 @@ static int update_kernel_stream(int fd) DBG("Channel found, updating kernel streams"); ret = kernel_open_channel_stream(channel); if (ret < 0) { - goto end; + goto error; } /* @@ -620,20 +620,20 @@ static int update_kernel_stream(int fd) ret = send_kconsumerd_channel_fds(session->kernel_session->consumer_fd, channel); if (ret < 0) { - goto end; + goto error; } } - goto end; + goto error; } } unlock_session(session); } + unlock_session_list(); + return ret; -end: +error: + unlock_session(session); unlock_session_list(); - if (session) { - unlock_session(session); - } return ret; } diff --git a/ltt-sessiond/traceable-app.c b/ltt-sessiond/traceable-app.c index cde3f97f2..653d86b3f 100644 --- a/ltt-sessiond/traceable-app.c +++ b/ltt-sessiond/traceable-app.c @@ -169,7 +169,6 @@ void unregister_traceable_app(int sock) DBG("PID %d unregistered with sock %d", lta->pid, sock); close(lta->sock); del_traceable_app(lta); - unlock_apps_list(); free(lta); } unlock_apps_list();