Fix: liblttng-ctl: leak of payload on field listing
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.c
index 012ba13b070c7c77707057322cf62e5fc9905f29..be397918f477512325c276fbbe8eca3749898cb1 100644 (file)
@@ -1726,13 +1726,13 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle,
        unsigned int nb_event_fields = 0;
        struct lttng_payload reply;
 
+       lttng_payload_init(&reply);
+
        if (handle == NULL) {
                ret = -LTTNG_ERR_INVALID;
                goto end;
        }
 
-       lttng_payload_init(&reply);
-
        memset(&lsm, 0, sizeof(lsm));
        lsm.cmd_type = LTTNG_LIST_TRACEPOINT_FIELDS;
        COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
@@ -1786,6 +1786,7 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle,
        ret = nb_event_fields;
 
 end:
+       lttng_payload_reset(&reply);
        return ret;
 }
 
This page took 0.024157 seconds and 4 git commands to generate.