From: David Goulet Date: Tue, 28 May 2013 19:07:30 +0000 (-0400) Subject: Fix: dereference after NULL check X-Git-Tag: v2.2.0-rc3~40 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=094d1690f11fb6aeddac6acd71ba50a3c4e4e9b1 Fix: dereference after NULL check From coverity scan. Signed-off-by: David Goulet --- diff --git a/src/bin/lttng-consumerd/lttng-consumerd.c b/src/bin/lttng-consumerd/lttng-consumerd.c index edf1f152f..8ddd5a372 100644 --- a/src/bin/lttng-consumerd/lttng-consumerd.c +++ b/src/bin/lttng-consumerd/lttng-consumerd.c @@ -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); diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index 5710226fc..dfc4599be 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -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; }