From b3c750d2ffae77322752a5b4f43bd4ddae3dfea6 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 10 Sep 2011 12:17:56 -0700 Subject: [PATCH] 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 --- ltt-sessiond/main.c | 14 +++++++------- ltt-sessiond/traceable-app.c | 1 - 2 files changed, 7 insertions(+), 8 deletions(-) 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(); -- 2.34.1