From: David Goulet Date: Wed, 29 Jun 2011 22:05:06 +0000 (-0400) Subject: Fix possible null pointer X-Git-Tag: v2.0-pre1~67 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=94cf3c47fe93b891dac6206bbcf712d042d15727;ds=sidebyside Fix possible null pointer Signed-off-by: David Goulet --- diff --git a/liblttngctl/liblttngctl.c b/liblttngctl/liblttngctl.c index 31693942d..e05496a94 100644 --- a/liblttngctl/liblttngctl.c +++ b/liblttngctl/liblttngctl.c @@ -257,11 +257,11 @@ int lttng_stop_tracing(char *session_name) int lttng_kernel_add_context(struct lttng_kernel_context *ctx, char *event_name, char *channel_name) { - if (strlen(channel_name) != 0) { + if (channel_name != NULL) { strncpy(lsm.u.context.channel_name, channel_name, NAME_MAX); } - if (strlen(event_name) != 0) { + if (event_name != NULL) { strncpy(lsm.u.context.event_name, event_name, NAME_MAX); } @@ -276,7 +276,7 @@ int lttng_kernel_enable_event(struct lttng_event *ev, char *channel_name) { int ret; - if (strlen(channel_name) == 0) { + if (channel_name == NULL) { strncpy(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME, NAME_MAX); } else { strncpy(lsm.u.enable.channel_name, channel_name, NAME_MAX); @@ -301,7 +301,7 @@ int lttng_kernel_disable_event(char *name, char *channel_name) { int ret; - if (strlen(channel_name) == 0) { + if (channel_name == NULL) { strncpy(lsm.u.disable.channel_name, DEFAULT_CHANNEL_NAME, NAME_MAX); } else { strncpy(lsm.u.disable.channel_name, channel_name, NAME_MAX);