Fix: liblttng-ctl: leak of payload on field listing
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.cpp
index 057a91e3e57f73f0b0afc5fd26e8c9f731efbb1e..3d0c8b412cc7297914051a3417831d417857bf28 100644 (file)
@@ -1747,13 +1747,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);
@@ -1807,6 +1807,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.022978 seconds and 4 git commands to generate.