From a02e15e87391449a7a9d025fe7593339d8a3ba41 Mon Sep 17 00:00:00 2001 From: Pavel Shlyak Date: Sun, 12 Jul 2020 10:58:34 +0300 Subject: Avoid memory leak in java utils --- src/java-utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/java-utils.c b/src/java-utils.c index 1efcb3f..7fa0ff3 100644 --- a/src/java-utils.c +++ b/src/java-utils.c @@ -309,7 +309,9 @@ get_package_name_from_class_file (char *fname) for (j = length; (j >= 0) && (end == 0); j--) if (package[j] == '/') end = j; - package = g_strndup (package, end); + char *package_padded = g_strndup (package, end); + g_free(package); + package = package_padded; } java_class_file_free (cfile); -- cgit v1.2.1