From: poljar (Damir Jelić) <[email protected]>
If a bogus driver name is specified on the command line or for some reason we
fail to initialize a driver device_scan() leaks data.
This patch adds appropriate free calls.
---
sigrok-cli.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sigrok-cli.c b/sigrok-cli.c
index 39cbb77..3f4ee69 100644
--- a/sigrok-cli.c
+++ b/sigrok-cli.c
@@ -178,11 +178,14 @@ static GSList *device_scan(void)
}
if (!driver) {
g_critical("Driver %s not found.", drvname);
+ g_hash_table_destroy(drvargs);
+ g_free(drvname);
return NULL;
}
g_free(drvname);
if (sr_driver_init(sr_ctx, driver) != SR_OK) {
g_critical("Failed to initialize driver.");
+ g_hash_table_destroy(drvargs);
return NULL;
}
drvopts = NULL;
@@ -193,7 +196,7 @@ static GSList *device_scan(void)
return NULL;
}
}
- g_hash_table_destroy(drvargs);
+ g_hash_table_destroy(drvargs);
devices = sr_driver_scan(driver, drvopts);
g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts);
} else {
--
1.8.4.2
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel