Fix: common: local_attr might leak
[lttng-tools.git] / src / common / event.c
index b90bc2a2f33cf6bc1610895c47ae1eb879ecd0cb..850b97f14ec9738a86e5919cc22cc0cbc69c5b1d 100644 (file)
@@ -194,6 +194,7 @@ static ssize_t lttng_event_probe_attr_create_from_buffer(
        local_attr = NULL;
        ret = offset;
 end:
+       free(local_attr);
        return ret;
 }
 
@@ -252,6 +253,7 @@ static ssize_t lttng_event_function_attr_create_from_buffer(
        local_attr = NULL;
        ret = offset;
 end:
+       free(local_attr);
        return ret;
 }
 
@@ -1197,7 +1199,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) {
@@ -1206,7 +1209,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(buffer, &comm, sizeof(comm));
This page took 0.024001 seconds and 4 git commands to generate.