X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=liblttngctl%2Flttngctl.c;h=0442a4f02bdbc686a868bf1abbc40a1896420894;hb=2c58cc2eccbb85063cc547c0259d276a2be5c0a4;hp=b64ace2e6d80de0ce085791f698604e53f8eb523;hpb=6e81efd4955d52288a4b5fd462e9e51ca44e3f8f;p=lttng-tools.git diff --git a/liblttngctl/lttngctl.c b/liblttngctl/lttngctl.c index b64ace2e6..0442a4f02 100644 --- a/liblttngctl/lttngctl.c +++ b/liblttngctl/lttngctl.c @@ -152,6 +152,10 @@ static int check_tracing_group(const char *grp_name) /* Alloc group list of the right size */ grp_list = malloc(grp_list_size * sizeof(gid_t)); + if (!grp_list) { + ret = -1; + goto end; + } grp_id = getgroups(grp_list_size, grp_list); if (grp_id < -1) { perror("getgroups"); @@ -488,7 +492,7 @@ int lttng_enable_event(struct lttng_handle *handle, { struct lttcomm_session_msg lsm; - if (!handle) { + if (!handle || ev == NULL) { return -1; } @@ -502,12 +506,12 @@ int lttng_enable_event(struct lttng_handle *handle, copy_lttng_domain(&lsm.domain, &handle->domain); - if (ev) { + if (ev->name[0] != '\0') { lsm.cmd_type = LTTNG_ENABLE_EVENT; - memcpy(&lsm.u.enable.event, ev, sizeof(lsm.u.enable.event)); } else { lsm.cmd_type = LTTNG_ENABLE_ALL_EVENT; } + memcpy(&lsm.u.enable.event, ev, sizeof(lsm.u.enable.event)); copy_string(lsm.session.name, handle->session_name, sizeof(lsm.session.name));