Skip to content

Commit 0446b9e

Browse files
KonTyYou name
andauthored
Fix several memory leaks. (#3721)
Free results from g_file_get_path(), nemo_file_get_by_uri(), nemo_file_get_display_name(), nemo_file_get_activation_uri(), and g_settings_get_string() that were missing cleanup calls. Co-authored-by: You name <konty@github.com>
1 parent 66d4299 commit 0446b9e

File tree

5 files changed

+11
-3
lines changed

5 files changed

+11
-3
lines changed

libnemo-private/nemo-file-conflict-dialog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ file_list_ready_cb (GList *files,
106106
NemoFileConflictDialogDetails *details;
107107
char *primary_text, *message, *secondary_text;
108108
const gchar *message_extra;
109-
char *dest_name, *dest_dir_name, *edit_name;
109+
char *edit_name;
110110
char *label_text;
111111
char *size, *date, *type = NULL;
112112
GdkPixbuf *pixbuf;
@@ -127,8 +127,8 @@ file_list_ready_cb (GList *files,
127127
src_mtime = nemo_file_get_mtime (src);
128128
dest_mtime = nemo_file_get_mtime (dest);
129129

130-
dest_name = nemo_file_get_display_name (dest);
131-
dest_dir_name = nemo_file_get_display_name (dest_dir);
130+
g_autofree gchar *dest_name = nemo_file_get_display_name (dest);
131+
g_autofree gchar *dest_dir_name = nemo_file_get_display_name (dest_dir);
132132

133133
source_is_dir = nemo_file_is_directory (src);
134134
dest_is_dir = nemo_file_is_directory (dest);

src/nemo-mime-actions.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,7 @@ open_with_dialog_response_cb (GtkDialog *dialog,
11491149

11501150
gtk_widget_destroy (GTK_WIDGET (dialog));
11511151
g_object_unref (info);
1152+
nemo_file_unref (file);
11521153
}
11531154

11541155
static void
@@ -1179,6 +1180,9 @@ run_open_with_dialog (ActivateParametersSpecial *params)
11791180

11801181
GtkWidget *chooser = nemo_mime_application_chooser_new (uri, uris, mime_type, ok_button);
11811182

1183+
g_free (uri);
1184+
g_free (mime_type);
1185+
11821186
GtkWidget *content = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
11831187

11841188
gtk_box_pack_start (GTK_BOX (content), chooser, TRUE, TRUE, 0);
@@ -1713,6 +1717,7 @@ activate_files (ActivateParameters *parameters)
17131717

17141718
file_path = g_file_get_path (initial_location);
17151719
uri = g_strconcat ("admin://", file_path, NULL);
1720+
g_free (file_path);
17161721
}
17171722

17181723
final_location = g_file_new_for_uri (uri);

src/nemo-open-with-main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ app_chooser_dialog_response_cb (GtkDialog *dialog,
8080

8181
gtk_widget_destroy (GTK_WIDGET (dialog));
8282
g_object_unref (info);
83+
nemo_file_unref (file);
8384
}
8485

8586
int

src/nemo-properties-window.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3052,6 +3052,7 @@ create_volume_usage_widget (NemoPropertiesWindow *window)
30523052
uri = nemo_file_get_activation_uri (file);
30533053

30543054
location = g_file_new_for_uri (uri);
3055+
g_free (uri);
30553056
info = g_file_query_filesystem_info (location, "filesystem::*", NULL, NULL);
30563057

30573058
if (info) {

src/nemo-window.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@ nemo_window_show (GtkWidget *widget)
16231623

16241624
window = NEMO_WINDOW (widget);
16251625

1626+
g_free (window->details->sidebar_id);
16261627
window->details->sidebar_id = g_settings_get_string (nemo_window_state,
16271628
NEMO_WINDOW_STATE_SIDE_PANE_VIEW);
16281629

0 commit comments

Comments
 (0)