Fix: sessiond: NULL pointer dereference after NULL check
[lttng-tools.git] / src / common / tracker.c
index 532a924b56a772b3d55d11e611028ebf7267a7fe..e4aae431d19a4896c818267c4ab781c0b85bac08 100644 (file)
@@ -85,6 +85,7 @@ enum lttng_error_code process_attr_value_from_comm(
                name = strdup(value_view->data);
                if (!name) {
                        ret = LTTNG_ERR_NOMEM;
+                       goto error;
                }
        }
 
@@ -105,7 +106,8 @@ enum lttng_error_code process_attr_value_from_comm(
        if (is_value_type_name(value_type) && value_view->size == 0) {
                ret = LTTNG_ERR_INVALID_PROTOCOL;
                goto error;
-       } else if (!is_value_type_name(value_type) && value_view->size != 0) {
+       } else if (!is_value_type_name(value_type) && value_view &&
+                       value_view->size != 0) {
                ret = LTTNG_ERR_INVALID_PROTOCOL;
                goto error;
        }
@@ -173,6 +175,7 @@ enum lttng_error_code process_attr_value_from_comm(
 
        *_value = value;
        value = NULL;
+       free(name);
        return LTTNG_OK;
 error:
        free(name);
This page took 0.024494 seconds and 4 git commands to generate.