[DTrace-devel] [PATCH] Fix memory leak
eugene.loh at oracle.com
eugene.loh at oracle.com
Wed Jun 3 13:54:43 PDT 2020
From: Eugene Loh <eugene.loh at oracle.com>
In c333e1c0eb57371f8227dd7491ef085e95bff051
("Convert dtrace_probedesc_t to the new form (with char * members)."),
statically sized character arrays in dtrace_probedesc_t used for
module, function, and probe names were replaced with character strings.
As a result, a local, fixed-size array was replace with a dynamically
allocated array.
Free the allocated array after its use.
Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
cmd/dtrace.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cmd/dtrace.c b/cmd/dtrace.c
index 3dc49800..f9f7a08d 100644
--- a/cmd/dtrace.c
+++ b/cmd/dtrace.c
@@ -771,6 +771,8 @@ chew(const dtrace_probedata_t *data, void *arg)
oprintf("%3d %6d %32s ", cpu, pd->id, name);
else
oprintf("%32s ", name);
+
+ free(name);
}
} else {
int indent = data->dtpda_indent;
--
2.18.2
More information about the DTrace-devel
mailing list