From 3c2b15fb155459369885fa6f6e6a4f5e98b42b66 Mon Sep 17 00:00:00 2001 From: Luca Bacci Date: Wed, 21 Dec 2022 15:01:45 +0100 Subject: [PATCH] GWin32AppInfo: Fix use-after-free --- gio/gwin32appinfo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gio/gwin32appinfo.c b/gio/gwin32appinfo.c index 5ed39837b..0a6f8ae29 100644 --- a/gio/gwin32appinfo.c +++ b/gio/gwin32appinfo.c @@ -5298,14 +5298,18 @@ make_item_array (gboolean for_files, } hr = SHParseDisplayName (file_or_uri_utf16, NULL, &item_ids[i], 0, NULL); - g_free (file_or_uri_utf16); if (FAILED (hr)) { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "File or URI `%S' cannot be parsed by SHParseDisplayName: 0x%lx", file_or_uri_utf16, hr); + "File or URI `%S' cannot be parsed by SHParseDisplayName: 0x%lx", + file_or_uri_utf16, hr); + + g_free (file_or_uri_utf16); break; } + + g_free (file_or_uri_utf16); } if (i == count)