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>
This commit is contained in:
Dirk Hohndel 2012-09-30 09:01:15 -07:00
parent 24c6197c10
commit 02bfd2d9ea

View file

@ -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");