ltt-sessiond: fix 2 double-unlock
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 10 Sep 2011 19:17:56 +0000 (12:17 -0700)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 10 Sep 2011 19:17:56 +0000 (12:17 -0700)
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 <mathieu.desnoyers@efficios.com>
ltt-sessiond/main.c
ltt-sessiond/traceable-app.c

index 77497d570b68e3e10aaf2a2386321ac66bd55d8c..094fe4adf75fd68b80cfed7e3665309340efc753 100644 (file)
@@ -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;
 }
 
index cde3f97f2e5a798b47b28156b4e0def6d2ac9a58..653d86b3fe3cbf675d25428a446b9be6b672e79a 100644 (file)
@@ -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();
This page took 0.028309 seconds and 4 git commands to generate.