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.
}
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;
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 {