mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sign-file: fix memory leak
@ 2023-05-25  8:43 Tianjia Zhang
  2023-06-09 17:45 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Tianjia Zhang @ 2023-05-25  8:43 UTC (permalink / raw)
  To: Jarkko Sakkinen, David Howells, David Woodhouse, keyrings, linux-kernel
  Cc: Tianjia Zhang

The buffer allocated by asprintf() must be freeed.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 scripts/sign-file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/sign-file.c b/scripts/sign-file.c
index b90fc9f7437f..94267cf72197 100644
--- a/scripts/sign-file.c
+++ b/scripts/sign-file.c
@@ -369,6 +369,7 @@ int main(int argc, char **argv)
 			    "%s", sig_file_name);
 #endif
 			BIO_free(b);
+			free(sig_file_name);
 		}
 
 		if (sign_only) {
@@ -420,8 +421,10 @@ int main(int argc, char **argv)
 	ERR(BIO_free(bd) < 0, "%s", dest_name);
 
 	/* Finally, if we're signing in place, replace the original. */
-	if (replace_orig)
+	if (replace_orig) {
 		ERR(rename(dest_name, module_name) < 0, "%s", dest_name);
+		free(dest_name);
+	}
 
 	return 0;
 }
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-09 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  8:43 [PATCH] sign-file: fix memory leak Tianjia Zhang
2023-06-09 17:45 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®