Fix: common: local_attr might leak
[lttng-tools.git] / src / common / event.c
index 4ea9ecf1e6b2a88ab075f6b6b45c05383c42a034..c3f040ff4847f4683132d02268e072543cb0450f 100644 (file)
@@ -201,6 +201,7 @@ static ssize_t lttng_event_probe_attr_create_from_payload(
        local_attr = NULL;
        ret = offset;
 end:
+       free(local_attr);
        return ret;
 }
 
@@ -262,6 +263,7 @@ static ssize_t lttng_event_function_attr_create_from_payload(
        local_attr = NULL;
        ret = offset;
 end:
+       free(local_attr);
        return ret;
 }
 
@@ -1146,7 +1148,8 @@ static int lttng_event_context_app_serialize(
        }
 
        /* Include the null terminator. */
-       comm.provider_name_len = provider_len + 1;
+       provider_len += 1;
+       comm.provider_name_len = provider_len;
 
        ctx_len = strlen(ctx_name);
        if (ctx_len == 0) {
@@ -1155,7 +1158,8 @@ static int lttng_event_context_app_serialize(
        }
 
        /* Include the null terminator. */
-       comm.ctx_name_len = ctx_len + 1;
+       ctx_len += 1;
+       comm.ctx_name_len = ctx_len;
 
        /* Header */
        ret = lttng_dynamic_buffer_append(&payload->buffer, &comm,
This page took 0.023392 seconds and 4 git commands to generate.