mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fixed a couple of memleaks in gtk-gui.c and info.c
Related to subsurface_default_filename() and g_path_get_basename().
Against 3835faa8fb.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
16bff5265e
commit
914488b796
2 changed files with 8 additions and 2 deletions
|
|
@ -526,6 +526,7 @@ static void pick_default_file(GtkWidget *w, GtkButton *button)
|
||||||
|
|
||||||
free(current_def_dir);
|
free(current_def_dir);
|
||||||
free(current_def_file);
|
free(current_def_file);
|
||||||
|
free((void *)current_default);
|
||||||
gtk_widget_destroy(fs_dialog);
|
gtk_widget_destroy(fs_dialog);
|
||||||
gtk_window_set_accept_focus(GTK_WINDOW(preferences), TRUE);
|
gtk_window_set_accept_focus(GTK_WINDOW(preferences), TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
info.c
9
info.c
|
|
@ -113,10 +113,13 @@ void show_dive_info(struct dive *dive)
|
||||||
const char *text;
|
const char *text;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
char title[80];
|
char title[80];
|
||||||
|
char *basename;
|
||||||
|
|
||||||
if (!dive) {
|
if (!dive) {
|
||||||
if (existing_filename) {
|
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);
|
gtk_window_set_title(GTK_WINDOW(main_window), title);
|
||||||
} else {
|
} else {
|
||||||
gtk_window_set_title(GTK_WINDOW(main_window), "Subsurface");
|
gtk_window_set_title(GTK_WINDOW(main_window), "Subsurface");
|
||||||
|
|
@ -145,7 +148,9 @@ void show_dive_info(struct dive *dive)
|
||||||
|
|
||||||
/* put it all together */
|
/* put it all together */
|
||||||
if (existing_filename) {
|
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);
|
gtk_window_set_title(GTK_WINDOW(main_window), title);
|
||||||
} else {
|
} else {
|
||||||
gtk_window_set_title(GTK_WINDOW(main_window), text);
|
gtk_window_set_title(GTK_WINDOW(main_window), text);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue