Simplify free() of channel attribute
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 May 2016 02:39:59 +0000 (22:39 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 May 2016 05:38:34 +0000 (01:38 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c

index b72b091989ce8ae001cba95bd53c6f5c6d92b0b9..d443d7926b7d9c25fc1b3dcdcbb8b1ced0bc97a4 100644 (file)
@@ -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;
 }
This page took 0.02857 seconds and 4 git commands to generate.