Fixed some memory leaks related to subsurface_get_conf()

In gtk-gui.c:init() we retrieve the configuration values
for PO2, PN2, PHE thresholds but have to also free the values
once done parsing with sscanf().

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2012-12-17 00:26:35 +02:00 committed by Dirk Hohndel
parent 28cc67c9a1
commit 5c58e1f868

View file

@ -1170,14 +1170,20 @@ void init_ui(int *argcp, char ***argvp)
prefs.pp_graphs.pn2 = PTR_TO_BOOL(subsurface_get_conf("pn2graph", PREF_BOOL)); prefs.pp_graphs.pn2 = PTR_TO_BOOL(subsurface_get_conf("pn2graph", PREF_BOOL));
prefs.pp_graphs.phe = PTR_TO_BOOL(subsurface_get_conf("phegraph", PREF_BOOL)); prefs.pp_graphs.phe = PTR_TO_BOOL(subsurface_get_conf("phegraph", PREF_BOOL));
conf_value = subsurface_get_conf("po2threshold", PREF_STRING); conf_value = subsurface_get_conf("po2threshold", PREF_STRING);
if (conf_value) if (conf_value) {
sscanf(conf_value, "%lf", &prefs.pp_graphs.po2_threshold); sscanf(conf_value, "%lf", &prefs.pp_graphs.po2_threshold);
free((void *)conf_value);
}
conf_value = subsurface_get_conf("pn2threshold", PREF_STRING); conf_value = subsurface_get_conf("pn2threshold", PREF_STRING);
if (conf_value) if (conf_value) {
sscanf(conf_value, "%lf", &prefs.pp_graphs.pn2_threshold); sscanf(conf_value, "%lf", &prefs.pp_graphs.pn2_threshold);
free((void *)conf_value);
}
conf_value = subsurface_get_conf("phethreshold", PREF_STRING); conf_value = subsurface_get_conf("phethreshold", PREF_STRING);
if (conf_value) if (conf_value) {
sscanf(conf_value, "%lf", &prefs.pp_graphs.phe_threshold); sscanf(conf_value, "%lf", &prefs.pp_graphs.phe_threshold);
free((void *)conf_value);
}
prefs.profile_red_ceiling = PTR_TO_BOOL(subsurface_get_conf("redceiling", PREF_BOOL)); prefs.profile_red_ceiling = PTR_TO_BOOL(subsurface_get_conf("redceiling", PREF_BOOL));
divelist_font = subsurface_get_conf("divelist_font", PREF_STRING); divelist_font = subsurface_get_conf("divelist_font", PREF_STRING);
autogroup = PTR_TO_BOOL(subsurface_get_conf("autogroup", PREF_BOOL)); autogroup = PTR_TO_BOOL(subsurface_get_conf("autogroup", PREF_BOOL));