Fix: dereference after NULL check
authorDavid Goulet <dgoulet@efficios.com>
Tue, 28 May 2013 19:07:30 +0000 (15:07 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 28 May 2013 19:16:35 +0000 (15:16 -0400)
From coverity scan.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-consumerd/lttng-consumerd.c
src/bin/lttng-sessiond/ust-app.c

index edf1f152f44a5d229fee090fd5b34c5d1146413b..8ddd5a372005490bb37f1ef8c01bc8045dabdbde 100644 (file)
@@ -469,7 +469,9 @@ metadata_error:
 
 error:
        ret = EXIT_FAILURE;
-       lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_EXIT_FAILURE);
+       if (ctx) {
+               lttng_consumer_send_error(ctx, LTTCOMM_CONSUMERD_EXIT_FAILURE);
+       }
 
 end:
        lttng_consumer_destroy(ctx);
index 5710226fc4504cb609eefa0b31ac4c989e15276a..dfc4599be858315b3a2b25956b0daa49e9d24bd2 100644 (file)
@@ -2404,7 +2404,7 @@ static int create_ust_app_channel(struct ust_app_session *ua_sess,
        if (ua_chan == NULL) {
                /* Only malloc can fail here */
                ret = -ENOMEM;
-               goto error;
+               goto error_alloc;
        }
        shadow_copy_channel(ua_chan, uchan);
 
@@ -2432,6 +2432,7 @@ end:
 
 error:
        delete_ust_app_channel(ua_chan->is_sent ? app->sock : -1, ua_chan, app);
+error_alloc:
        return ret;
 }
 
This page took 0.028766 seconds and 4 git commands to generate.