summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2012-12-17 00:26:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-16 15:57:11 -1000
commit5c58e1f8686c9b36daf8f1733e53b1f56d4ef123 (patch)
tree8df14a054ff0476751aada7a0a31f6166331d6da
parent28cc67c9a1b6c24efc2bcac12587de45484e05a6 (diff)
downloadsubsurface-5c58e1f8686c9b36daf8f1733e53b1f56d4ef123.tar.gz
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>
-rw-r--r--gtk-gui.c12
1 files changed, 9 insertions, 3 deletions
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));