Anastasia Klimchuk has uploaded this change for review.

View Change

serprog: Fix scan-build warning of resource leak

Warning found by the latest scan-build run:

*** CID 1534883: (RESOURCE_LEAK)
/serprog.c: 853 in serprog_init()
847 "by programmer!\n", cs_num8);
848 goto init_err_cleanup_exit;
849 }
850 }
851 bt = serprog_buses_supported;
852 if (sp_docommand(S_CMD_S_BUSTYPE, 1, &bt, 0, NULL))
>>>CID 1534883: (RESOURCE_LEAK)
>>>Variable "cs" going out of scope leaks the storage it points to.
853 goto init_err_cleanup_exit;
854 }

Change-Id: Id9cf211de3c482f702adebfcfa274a183c83a33f
Signed-off-by: Anastasia Klimchuk <aklm@flashrom.org>
---
M serprog.c
1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/32/81032/1
diff --git a/serprog.c b/serprog.c
index c2965c5..4f9bcc7 100644
--- a/serprog.c
+++ b/serprog.c
@@ -848,6 +848,8 @@
goto init_err_cleanup_exit;
}
}
+ free(cs);
+
bt = serprog_buses_supported;
if (sp_docommand(S_CMD_S_BUSTYPE, 1, &bt, 0, NULL))
goto init_err_cleanup_exit;

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

Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: Id9cf211de3c482f702adebfcfa274a183c83a33f
Gerrit-Change-Number: 81032
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: newchange