Fix possible NULL UST session on start trace
authorDavid Goulet <david.goulet@polymtl.ca>
Mon, 14 Nov 2011 17:08:00 +0000 (12:08 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Mon, 14 Nov 2011 17:11:14 +0000 (12:11 -0500)
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
lttng-sessiond/main.c

index d1d184d89eae8915d8d8808a638ca245e0b98765..fa196e7b033bfe07f97ac994803afc384c6f274c 100644 (file)
@@ -1098,7 +1098,7 @@ static void *thread_manage_apps(void *data)
                                                goto error;
                                        }
 
-                                       /* Socket closed */
+                                       /* Socket closed on remote end. */
                                        ust_app_unregister(pollfd);
                                        break;
                                }
@@ -2493,10 +2493,11 @@ static int cmd_start_trace(struct ltt_session *session)
 {
        int ret;
        struct ltt_kernel_session *ksession;
-       struct ltt_ust_session *usess = session->ust_session;
+       struct ltt_ust_session *usess;
 
        /* Short cut */
        ksession = session->kernel_session;
+       usess = session->ust_session;
 
        /* Kernel tracing */
        if (ksession != NULL) {
@@ -2553,12 +2554,14 @@ static int cmd_start_trace(struct ltt_session *session)
        }
 
        /* Flag session that trace should start automatically */
-       usess->start_trace = 1;
+       if (usess) {
+               usess->start_trace = 1;
 
-       ret = ust_app_start_trace_all(usess);
-       if (ret < 0) {
-               ret = LTTCOMM_UST_START_FAIL;
-               goto error;
+               ret = ust_app_start_trace_all(usess);
+               if (ret < 0) {
+                       ret = LTTCOMM_UST_START_FAIL;
+                       goto error;
+               }
        }
 
        ret = LTTCOMM_OK;
This page took 0.03776 seconds and 4 git commands to generate.