From: Jérémie Galarneau Date: Tue, 17 May 2016 02:39:59 +0000 (-0400) Subject: Simplify free() of channel attribute X-Git-Tag: v2.8.0~82 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ea1e385730a56475ac364739fa4da34da5dacc53;p=lttng-tools.git Simplify free() of channel attribute Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index b72b09198..d443d7926 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1810,7 +1810,7 @@ static int _cmd_enable_event(struct ltt_session *session, int wpipe, bool internal_event) { int ret, channel_created = 0; - struct lttng_channel *attr; + struct lttng_channel *attr = NULL; assert(session); assert(event); @@ -1856,17 +1856,13 @@ static int _cmd_enable_event(struct ltt_session *session, if (lttng_strncpy(attr->name, channel_name, sizeof(attr->name))) { ret = LTTNG_ERR_INVALID; - free(attr); goto error; } ret = cmd_enable_channel(session, domain, attr, wpipe); if (ret != LTTNG_OK) { - free(attr); goto error; } - free(attr); - channel_created = 1; } @@ -1998,16 +1994,13 @@ static int _cmd_enable_event(struct ltt_session *session, if (lttng_strncpy(attr->name, channel_name, sizeof(attr->name))) { ret = LTTNG_ERR_INVALID; - free(attr); goto error; } ret = cmd_enable_channel(session, domain, attr, wpipe); if (ret != LTTNG_OK) { - free(attr); goto error; } - free(attr); /* Get the newly created channel reference back */ uchan = trace_ust_find_channel_by_name( @@ -2182,6 +2175,7 @@ error: free(filter_expression); free(filter); free(exclusion); + free(attr); rcu_read_unlock(); return ret; }