Skip to content

Commit f980892

Browse files
authored
automount: fix automount with active screensaver and memleak (#426)
* automount: fix queue iteration fix use-after-free bug caused by dereferencing l after g_list_remove. This change also fixes auto-mounting multiple volumes that were connected while the screensaver was active. * automount: fix memleak in csd-autorun guessed_content_type also has to be freed if non-NULL (no error) but empty.
1 parent b5da80d commit f980892

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

plugins/automount/csd-automount-manager.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,8 @@ check_volume_queue (CsdAutomountManager *manager)
190190
g_list_remove (manager->priv->volume_queue, volume);
191191

192192
g_object_unref (volume);
193-
l = l->next;
193+
l = manager->priv->volume_queue;
194194
}
195-
196-
manager->priv->volume_queue = NULL;
197195
}
198196

199197
static void

plugins/automount/csd-autorun.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ autorun_guessed_content_type_callback (GObject *source_object,
798798
gpointer user_data)
799799
{
800800
GError *error;
801-
char **guessed_content_type;
801+
g_auto(GStrv) guessed_content_type = NULL;
802802
AutorunData *data = user_data;
803803
gboolean open_folder;
804804

@@ -822,7 +822,6 @@ autorun_guessed_content_type_callback (GObject *source_object,
822822
open_folder = TRUE;
823823
}
824824
}
825-
g_strfreev (guessed_content_type);
826825
} else {
827826
if (g_settings_get_boolean (data->settings, "automount-open")) {
828827
open_folder = TRUE;

0 commit comments

Comments
 (0)