From 5c58e1f8686c9b36daf8f1733e53b1f56d4ef123 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 17 Dec 2012 00:26:35 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- gtk-gui.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'gtk-gui.c') diff --git a/gtk-gui.c b/gtk-gui.c index 834d1999f..2731f4f9e 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -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.phe = PTR_TO_BOOL(subsurface_get_conf("phegraph", PREF_BOOL)); conf_value = subsurface_get_conf("po2threshold", PREF_STRING); - if (conf_value) + if (conf_value) { sscanf(conf_value, "%lf", &prefs.pp_graphs.po2_threshold); + free((void *)conf_value); + } conf_value = subsurface_get_conf("pn2threshold", PREF_STRING); - if (conf_value) + if (conf_value) { sscanf(conf_value, "%lf", &prefs.pp_graphs.pn2_threshold); + free((void *)conf_value); + } conf_value = subsurface_get_conf("phethreshold", PREF_STRING); - if (conf_value) + if (conf_value) { 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)); divelist_font = subsurface_get_conf("divelist_font", PREF_STRING); autogroup = PTR_TO_BOOL(subsurface_get_conf("autogroup", PREF_BOOL)); -- cgit v1.2.3-70-g09d2