Cleanup: Replace all perror() uses by the PERROR macro
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index d573eb0be1834e4eab521819badd3e04c502d2b0..f879d8ddfd2ea7b036df41a12d256809cee3a715 100644 (file)
@@ -221,19 +221,19 @@ int lttng_check_tracing_group(void)
        /* Get number of supplementary group IDs */
        grp_list_size = getgroups(0, NULL);
        if (grp_list_size < 0) {
-               perror("getgroups");
+               PERROR("getgroups");
                goto end;
        }
 
        /* Alloc group list of the right size */
-       grp_list = malloc(grp_list_size * sizeof(gid_t));
+       grp_list = zmalloc(grp_list_size * sizeof(gid_t));
        if (!grp_list) {
-               perror("malloc");
+               PERROR("malloc");
                goto end;
        }
        grp_id = getgroups(grp_list_size, grp_list);
        if (grp_id < 0) {
-               perror("getgroups");
+               PERROR("getgroups");
                goto free_list;
        }
 
@@ -275,7 +275,7 @@ static int try_connect_sessiond(const char *sock_path)
 
        ret = lttcomm_close_unix_sock(ret);
        if (ret < 0) {
-               perror("lttcomm_close_unix_sock");
+               PERROR("lttcomm_close_unix_sock");
        }
 
        return 0;
@@ -446,7 +446,11 @@ int lttng_ctl_ask_sessiond_varlen(struct lttcomm_session_msg *lsm,
                goto end;
        }
 
-       data = (void*) malloc(size);
+       data = zmalloc(size);
+       if (!data) {
+               ret = -ENOMEM;
+               goto end;
+       }
 
        /* Get payload data */
        ret = recv_data_sessiond(data, size);
@@ -486,7 +490,7 @@ struct lttng_handle *lttng_create_handle(const char *session_name,
                goto end;
        }
 
-       handle = malloc(sizeof(struct lttng_handle));
+       handle = zmalloc(sizeof(struct lttng_handle));
        if (handle == NULL) {
                PERROR("malloc handle");
                goto end;
@@ -854,7 +858,7 @@ static int generate_filter(char *filter_expression,
 
        /* No need to keep the memory stream. */
        if (fclose(fmem) != 0) {
-               perror("fclose");
+               PERROR("fclose");
        }
 
        *ctxp = ctx;
@@ -865,7 +869,7 @@ parse_error:
        filter_parser_ctx_free(ctx);
 filter_alloc_error:
        if (fclose(fmem) != 0) {
-               perror("fclose");
+               PERROR("fclose");
        }
 error:
        return ret;
@@ -1212,6 +1216,7 @@ int lttng_disable_event(struct lttng_handle *handle, const char *name,
        struct lttng_event ev;
 
        memset(&ev, 0, sizeof(ev));
+       ev.loglevel = -1;
        ev.type = LTTNG_EVENT_ALL;
        lttng_ctl_copy_string(ev.name, name, sizeof(ev.name));
        return lttng_disable_event_ext(handle, &ev, channel_name, NULL);
This page took 0.024201 seconds and 4 git commands to generate.