diff mbox series

cpupower: Fixing memory leaks

Message ID 20241121133212.6809-1-liujing@cmss.chinamobile.com (mailing list archive)
State New
Headers show
Series cpupower: Fixing memory leaks | expand

Commit Message

liujing Nov. 21, 2024, 1:32 p.m. UTC
If execlp fails, page memory is not freed, so fix it.

Signed-off-by: liujing <liujing@cmss.chinamobile.com>
diff mbox series

Patch

diff --git a/tools/power/cpupower/utils/cpupower.c b/tools/power/cpupower/utils/cpupower.c
index 9ec973165af1..36d486199630 100644
--- a/tools/power/cpupower/utils/cpupower.c
+++ b/tools/power/cpupower/utils/cpupower.c
@@ -98,7 +98,7 @@  static int print_man_page(const char *subpage)
 	}
 
 	execlp("man", "man", page, NULL);
-
+	free(page);
 	/* should not be reached */
 	return -EINVAL;
 }