[libsoup/leaks: 5/5] soup-headers: fix a leak in the strict parsing code



commit 2b9054e0e289f696450bdfbff6ae01b9d9fdfb4f
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Fri Sep 6 14:43:48 2019 +0300

    soup-headers: fix a leak in the strict parsing code
    
    Once we bail out we are not going to add the rest of the items to the
    hash table, so we need to manually delete them, otherwise they leak.

 libsoup/soup-headers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libsoup/soup-headers.c b/libsoup/soup-headers.c
index 18ded840..5e70b97b 100644
--- a/libsoup/soup-headers.c
+++ b/libsoup/soup-headers.c
@@ -756,7 +756,7 @@ parse_param_list (const char *header, char delim, gboolean strict)
                if (strict && duplicated) {
                        soup_header_free_param_list (params);
                        params = NULL;
-                       g_free (item);
+                       g_slist_foreach (iter, (GFunc)g_free, NULL);
                        break;
                } else if (override || !duplicated)
                        g_hash_table_replace (params, item, value);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]