summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2012-09-18 14:24:54 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-18 07:29:33 -0400
commit914488b79691ec8286f59a927aea3257db7c1581 (patch)
treeb63913914ba10a6797456bf3142494488c6ca653 /info.c
parent16bff5265e58c9708cd2d28cc0d7d7c7ca569fe1 (diff)
downloadsubsurface-914488b79691ec8286f59a927aea3257db7c1581.tar.gz
Fixed a couple of memleaks in gtk-gui.c and info.c
Related to subsurface_default_filename() and g_path_get_basename(). Against 3835faa8fb02df8edb. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'info.c')
-rw-r--r--info.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/info.c b/info.c
index 3f7bbcd58..ad482f11d 100644
--- a/info.c
+++ b/info.c
@@ -113,10 +113,13 @@ void show_dive_info(struct dive *dive)
const char *text;
char buffer[80];
char title[80];
+ char *basename;
if (!dive) {
if (existing_filename) {
- snprintf(title, 80, "Subsurface: %s", g_path_get_basename(existing_filename));
+ basename = g_path_get_basename(existing_filename);
+ snprintf(title, 80, "Subsurface: %s", basename);
+ free(basename);
gtk_window_set_title(GTK_WINDOW(main_window), title);
} else {
gtk_window_set_title(GTK_WINDOW(main_window), "Subsurface");
@@ -145,7 +148,9 @@ void show_dive_info(struct dive *dive)
/* put it all together */
if (existing_filename) {
- snprintf(title, 80, "%s: %s", g_path_get_basename(existing_filename), text);
+ basename = g_path_get_basename(existing_filename);
+ snprintf(title, 80, "%s: %s", basename, text);
+ free(basename);
gtk_window_set_title(GTK_WINDOW(main_window), title);
} else {
gtk_window_set_title(GTK_WINDOW(main_window), text);