From: Christian Goeschel Ndjomouo Date: Thu, 25 Dec 2025 15:19:20 +0000 (-0500) Subject: readprofile: fix memory leak related to boot_uname_r_str() in usage() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d5793ec573108ca912097933ed8a987716e5134;p=thirdparty%2Futil-linux.git readprofile: fix memory leak related to boot_uname_r_str() in usage() Signed-off-by: Christian Goeschel Ndjomouo --- diff --git a/sys-utils/readprofile.c b/sys-utils/readprofile.c index 3c200cf4d..0165a3373 100644 --- a/sys-utils/readprofile.c +++ b/sys-utils/readprofile.c @@ -91,6 +91,7 @@ static char *boot_uname_r_str(void) static void __attribute__((__noreturn__)) usage(void) { FILE *out = stdout; + char *mapfile = boot_uname_r_str(); fputs(USAGE_HEADER, out); fprintf(out, _(" %s [options]\n"), program_invocation_short_name); @@ -100,7 +101,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(USAGE_OPTIONS, out); fprintf(out, _(" -m, --mapfile (defaults: \"%s\" and\n" - " \"%s\")\n"), defaultmap, boot_uname_r_str()); + " \"%s\")\n"), defaultmap, mapfile); fprintf(out, _(" -p, --profile (default: \"%s\")\n"), defaultpro); fputs(_(" -M, --multiplier set the profiling multiplier to \n"), out); @@ -114,6 +115,7 @@ static void __attribute__((__noreturn__)) usage(void) fputs(USAGE_SEPARATOR, out); fprintf(out, USAGE_HELP_OPTIONS(27)); fprintf(out, USAGE_MAN_TAIL("readprofile(8)")); + free(mapfile); exit(EXIT_SUCCESS); }