The strings duplicated with strdup() for each "wurfl-information-list" token
(wi->data.name) and each "wurfl-patch-file" path (wp->patch_file_path) were
never freed: ha_wurfl_deinit() only freed the list nodes, not the strings they
own. A simple config check on a configuration using these keywords is enough to
leak them, as reported by ASAN.

Free wi->data.name and wp->patch_file_path before freeing their list nodes.

This bug has been present since the module was introduced in commit d0027ed5b
("MEDIUM: wurfl: add Scientiamobile WURFL device detection module"). It should
be backported to all stable versions.

This fixes issue #2084.
Reported-by: Илья Шипицин <[email protected]>
---
 addons/wurfl/wurfl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/addons/wurfl/wurfl.c b/addons/wurfl/wurfl.c
index 4df647390..31a61c4a6 100644
--- a/addons/wurfl/wurfl.c
+++ b/addons/wurfl/wurfl.c
@@ -413,11 +413,13 @@ static void ha_wurfl_deinit(void)
 
        list_for_each_entry_safe(wi, wi2, &global_wurfl.information_list, list) 
{
                LIST_DELETE(&wi->list);
+               free(wi->data.name);
                free(wi);
        }
 
        list_for_each_entry_safe(wp, wp2, &global_wurfl.patch_file_list, list) {
                LIST_DELETE(&wp->list);
+               free(wp->patch_file_path);
                free(wp);
        }
 
-- 
2.34.1



Reply via email to