Fix: lttng: leak of userspace probe path on listing
[lttng-tools.git] / src / bin / lttng / commands / list.c
index 372a71dad1d2579f4cd329f9cd97180c867d52f7..e96fe35dce5a1d5097829d85a9b94b43a2e732b9 100644 (file)
@@ -273,7 +273,7 @@ static void print_userspace_probe_location(struct lttng_event *event)
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
        {
                const char *function_name;
-               const char *binary_path;
+               char *binary_path;
 
                MSG("%sType: Function", indent8);
                function_name = lttng_userspace_probe_location_function_get_function_name(location);
@@ -292,12 +292,14 @@ static void print_userspace_probe_location(struct lttng_event *event)
                        MSG("%sLookup method: INVALID LOOKUP TYPE ENCOUNTERED", indent8);
                        break;
                }
+
+               free(binary_path);
                break;
        }
        case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT:
        {
                const char *probe_name, *provider_name;
-               const char *binary_path;
+               char *binary_path;
 
                MSG("%sType: Tracepoint", indent8);
                probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(location);
@@ -313,6 +315,8 @@ static void print_userspace_probe_location(struct lttng_event *event)
                        MSG("%sLookup method: INVALID LOOKUP TYPE ENCOUNTERED", indent8);
                        break;
                }
+
+               free(binary_path);
                break;
        }
        default:
This page took 0.023887 seconds and 5 git commands to generate.