1From f95ca6cb713383548f16f9a8ba2f6c51a4d25e25 Mon Sep 17 00:00:00 2001 2From: Michael Catanzaro <mcatanzaro@redhat.com> 3Date: Fri, 17 Jun 2022 08:48:10 -0500 4Subject: [PATCH] xdgmime: fix double free 5 6We free xdg_dirs[i] twice, but fail to free xdg_dirs itself. 7 8Also, since free() is NULL-safe, there is no need for the second check 9here. 10 11Discovered in: https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/16#note_1432025 12 13Conflict:NA 14Reference:https://gitlab.gnome.org/GNOME/glib/-/commit/f95ca6cb713383548f16f9a8ba2f6c51a4d25e25 15 16--- 17 gio/xdgmime/xdgmime.c | 3 +-- 18 1 file changed, 1 insertion(+), 2 deletions(-) 19 20diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c 21index 9ab6760486..c3c11625e8 100644 22--- a/gio/xdgmime/xdgmime.c 23+++ b/gio/xdgmime/xdgmime.c 24@@ -350,8 +350,7 @@ xdg_mime_set_dirs (const char * const *dirs) 25 26 for (i = 0; xdg_dirs != NULL && xdg_dirs[i] != NULL; i++) 27 free (xdg_dirs[i]); 28- if (xdg_dirs != NULL) 29- free (xdg_dirs[i]); 30+ free (xdg_dirs); 31 xdg_dirs = NULL; 32 33 if (dirs != NULL) 34-- 35GitLab 36 37