]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: wurfl: fix memory leak of information list and patch strings at deinit
authorscientiamobile <haproxy@scientiamobile.com>
Tue, 11 Aug 2026 10:15:39 +0000 (12:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Aug 2026 09:00:22 +0000 (11:00 +0200)
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: Ilya Shipitsin <chipitsine@gmail.com>
addons/wurfl/wurfl.c

index 4df64739025481eb6b1fd2f0e39f347816a98257..31a61c4a61b0ea8bfcbe42718f82f62e0037e15d 100644 (file)
@@ -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);
        }