Joursoir has uploaded this change for review.

View Change

cli_classic: fix memory leak

If parameter --wp-region is used and wp_region is allocated,
free the last one at the exit of the application.

Found-by: scan-build, clang v13.0.1
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Change-Id: I8520e302e9d63ed1215c5d9beb90a93fb52a91fe
---
M cli_classic.c
1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/51/64351/1
diff --git a/cli_classic.c b/cli_classic.c
index 9543009..5cd05a7 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -1100,6 +1100,8 @@
free(referencefile);
free(layoutfile);
free(pparam);
+ if (set_wp_region && wp_region)
+ free(wp_region);
/* clean up global variables */
free((char *)chip_to_probe); /* Silence! Freeing is not modifying contents. */
chip_to_probe = NULL;

To view, visit change 64351. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I8520e302e9d63ed1215c5d9beb90a93fb52a91fe
Gerrit-Change-Number: 64351
Gerrit-PatchSet: 1
Gerrit-Owner: Joursoir <chat@joursoir.net>
Gerrit-MessageType: newchange