summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-30 09:01:15 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-30 09:01:15 -0700
commit02bfd2d9ea180047a8af90a80edb32ee51690c3a (patch)
tree1388b1e12b9ebda6b0a7abdc93ca77418efab50b
parent24c6197c1019e8a3e7e5924522071be5a68a7be9 (diff)
downloadsubsurface-02bfd2d9ea180047a8af90a80edb32ee51690c3a.tar.gz
Better fix for one of the memory leaks
The return value of subsurface_get_conf is a const void * - so we shouldn't just assign it to a variable where we know it will be changed. Instead we duplicate the string and free the original one. A little less efficient but cleaner. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--gtk-gui.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 7032b1a04..3eac5399e 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -1027,7 +1027,8 @@ void init_ui(int *argcp, char ***argvp)
if (!conf_value)
uemis_max_dive_data = strdup("");
else
- uemis_max_dive_data = conf_value;
+ uemis_max_dive_data = strdup(conf_value);
+ free(conf_value);
error_info_bar = NULL;
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_set_application_name ("subsurface");