Skip to content

Commit

Permalink
Merge pull request #30 from ebbes/fixleaks
Browse files Browse the repository at this point in the history
Fix leaks. Ported from Nautilus 3.6
  • Loading branch information
clefebvre committed Oct 1, 2012
2 parents 0654ded + 4d09261 commit 988f831
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions eel/eel-gnome-extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ try_terminal_command (const char *program,
}

quoted = g_shell_quote (program_in_path);
g_free (program_in_path);
if (args == NULL || args[0] == '\0') {
return quoted;
}
Expand Down
1 change: 1 addition & 0 deletions eel/eel-gtk-extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ tree_view_button_press_callback (GtkWidget *tree_view,
NULL)) {
gtk_tree_view_row_activated
(GTK_TREE_VIEW (tree_view), path, column);
gtk_tree_path_free (path);
}
}

Expand Down
7 changes: 5 additions & 2 deletions libnemo-private/nemo-file-operations.c
Original file line number Diff line number Diff line change
Expand Up @@ -3789,15 +3789,17 @@ copy_file_progress_callback (goffset current_num_bytes,
static gboolean
test_dir_is_parent (GFile *child, GFile *root)
{
GFile *f;
GFile *f, *tmp;

f = g_file_dup (child);
while (f) {
if (g_file_equal (f, root)) {
g_object_unref (f);
return TRUE;
}
tmp = f;
f = g_file_get_parent (f);
g_object_unref (tmp);
}
if (f) {
g_object_unref (f);
Expand Down Expand Up @@ -4806,6 +4808,7 @@ move_file_prepare (CopyMoveJob *move_job,

if (IS_IO_ERROR (error, INVALID_FILENAME) &&
!handled_invalid_filename) {
g_error_free (error);
handled_invalid_filename = TRUE;

g_assert (*dest_fs_type == NULL);
Expand Down Expand Up @@ -5772,7 +5775,7 @@ nemo_file_operations_copy_move (const GList *item_uris,

locations = location_list_from_uri_list (item_uris);

for (p = location_list_from_uri_list (item_uris); p != NULL; p = p->next) {
for (p = locations; p != NULL; p = p->next) {
if (!g_file_has_uri_scheme ((GFile* )p->data, "burn")) {
have_nonmapping_source = TRUE;
}
Expand Down
16 changes: 14 additions & 2 deletions libnemo-private/nemo-file-utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,13 +955,25 @@ nemo_find_file_insensitive_next (GFile *parent, const gchar *name)
return NULL;
}

static gboolean
have_program_in_path (const char *name)
{
char *path;
gboolean result;

path = g_find_program_in_path (name);
result = (path != NULL);
g_free (path);
return result;
}

gboolean
nemo_is_file_roller_installed (void)
{
static int installed = - 1;

if (installed < 0) {
if (g_find_program_in_path ("file-roller")) {
if (have_program_in_path ("file-roller")) {
installed = 1;
} else {
installed = 0;
Expand Down Expand Up @@ -1168,7 +1180,7 @@ nemo_trashed_files_get_original_directories (GList *files,
if (directories == NULL) {
directories = g_hash_table_new_full (g_direct_hash, g_direct_equal,
(GDestroyNotify) nemo_file_unref,
(GDestroyNotify) nemo_file_list_unref);
(GDestroyNotify) nemo_file_list_free);
}
nemo_file_ref (original_dir);
m = g_hash_table_lookup (directories, original_dir);
Expand Down
1 change: 1 addition & 0 deletions libnemo-private/nemo-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@ finalize (GObject *object)
}

eel_ref_str_unref (file->details->filesystem_id);
g_free (file->details->trash_orig_path);

g_list_free_full (file->details->mime_list, g_free);
g_list_free_full (file->details->pending_extension_emblems, g_free);
Expand Down
1 change: 1 addition & 0 deletions libnemo-private/nemo-query.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ finalize (GObject *object)

query = NEMO_QUERY (object);
g_free (query->details->text);
g_free (query->details->location_uri);

G_OBJECT_CLASS (nemo_query_parent_class)->finalize (object);
}
Expand Down
2 changes: 2 additions & 0 deletions libnemo-private/nemo-search-directory-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ nemo_search_directory_file_update_display_name (NemoSearchDirectoryFile *search_
if (changed) {
nemo_file_emit_changed (file);
}

g_free (display_name);
}

static void
Expand Down
1 change: 1 addition & 0 deletions src/nemo-places-sidebar.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ update_places (NemoPlacesSidebar *sidebar)

if (!g_file_is_native (root)) {
network_mounts = g_list_prepend (network_mounts, mount);
g_object_unref (root);
continue;
}

Expand Down
5 changes: 4 additions & 1 deletion src/nemo-view.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,8 @@ nemo_view_preview_files (NemoView *view,

xid = gdk_x11_window_get_xid (gtk_widget_get_window (toplevel));
nemo_previewer_call_show_file (previewer, uri, xid, TRUE);

g_free (uri);
}

void
Expand Down Expand Up @@ -7806,7 +7808,8 @@ update_restore_from_trash_action (GtkAction *action,
g_free (original_name);

g_object_set (action, "tooltip", tooltip, NULL);

g_free (tooltip);

if (original_location != NULL) {
g_object_unref (original_location);
}
Expand Down

0 comments on commit 988f831

Please sign in to comment.