diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-09-30 09:01:15 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-09-30 09:01:15 -0700 |
commit | 02bfd2d9ea180047a8af90a80edb32ee51690c3a (patch) | |
tree | 1388b1e12b9ebda6b0a7abdc93ca77418efab50b | |
parent | 24c6197c1019e8a3e7e5924522071be5a68a7be9 (diff) | |
download | subsurface-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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"); |