summaryrefslogtreecommitdiff
path: root/libsoup/soup-session.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2022-10-10 09:38:55 +0200
committerMilan Crha <mcrha@redhat.com>2022-10-10 09:38:55 +0200
commit7982ed911c3cf8dd2ca2a852174f64a90a428837 (patch)
tree511319f4831bd6da7106c06bcc64901a99f316bf /libsoup/soup-session.c
parenta948ac11b143d5db832749fdb19113fff6b614c1 (diff)
downloadlibsoup-7982ed911c3cf8dd2ca2a852174f64a90a428837.tar.gz
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.
Diffstat (limited to 'libsoup/soup-session.c')
-rw-r--r--libsoup/soup-session.c4
1 files changed, 3 insertions, 1 deletions
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);
}