From 02bfd2d9ea180047a8af90a80edb32ee51690c3a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 30 Sep 2012 09:01:15 -0700 Subject: [PATCH] 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 --- gtk-gui.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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");