Fix memory leaks
Change-Id: I2933bc09af6de8210a536f945cc22b66814d4096
Signed-off-by: Lukas Selinka <lukas.selinka@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/587
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: Nico Huber <nico.h@gmx.de>
diff --git a/layout.c b/layout.c
index 382b7e1..d4d9373 100644
--- a/layout.c
+++ b/layout.c
@@ -207,6 +207,7 @@
while (*args) {
tmp = (*args)->next;
+ free((*args)->name);
free(*args);
*args = tmp;
}
diff --git a/libflashprog.c b/libflashprog.c
index 24885a3..c2c12a1 100644
--- a/libflashprog.c
+++ b/libflashprog.c
@@ -177,6 +177,9 @@
{
if (programmer_shutdown(flashprog))
return 1;
+
+ if (flashprog->param)
+ free(flashprog->param);
free(flashprog);
return 0;
}