Skip to content

Commit

Permalink
Simplify free() of channel attribute
Browse files Browse the repository at this point in the history
Signed-off-by: Jérémie Galarneau <[email protected]>
  • Loading branch information
jgalar committed May 17, 2016
1 parent 04c1725 commit cfedea0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/bin/lttng-sessiond/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -2182,6 +2175,7 @@ static int _cmd_enable_event(struct ltt_session *session,
free(filter_expression);
free(filter);
free(exclusion);
free(attr);
rcu_read_unlock();
return ret;
}
Expand Down

0 comments on commit cfedea0

Please sign in to comment.