[libsoup/libsoup-3-2] soup-session: Fix memory free of reversed GList
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/libsoup-3-2] soup-session: Fix memory free of reversed GList
- Date: Tue, 11 Oct 2022 13:21:17 +0000 (UTC)
commit a04dff4a8c7fc76933fe9358475e1625fc29680e
Author: Milan Crha <mcrha redhat com>
Date: Mon Oct 10 09:38:55 2022 +0200
soup-session: Fix memory free of reversed GList
The g_list_reverse() modifies the `items` in a way, which can mean
the later call of `g_list_free (items);` frees only the last item,
not all of the items.
libsoup/soup-session.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index e3577428..de0da49c 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1824,7 +1824,9 @@ async_run_queue (SoupSession *session)
g_queue_foreach (priv->queue, (GFunc)collect_queue_item, &items);
g_mutex_unlock (&priv->queue_mutex);
- for (i = g_list_reverse (items); i != NULL; i = g_list_next (i)) {
+ items = g_list_reverse (items);
+
+ for (i = items; i != NULL; i = g_list_next (i)) {
SoupMessageQueueItem *item = (SoupMessageQueueItem *)i->data;
soup_session_process_queue_item (item->session, item, TRUE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]