options/m_option: free all list elements when removing them

Elements are not parented to the add list, as they are directly copied
to the target list. Therefore, we need to clean them up manually.

Fixes: 1f5a67d8fa
This commit is contained in:
Kacper Michajłow 2024-11-02 03:08:07 +01:00
parent 2054d872d4
commit 207aa647a5
1 changed files with 2 additions and 0 deletions

View File

@ -1319,6 +1319,8 @@ static int str_list_add(char **add, int n, void *dst, int pre)
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION #ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (ln >= 100) { if (ln >= 100) {
while (n--)
talloc_free(add[n]);
talloc_free(add); talloc_free(add);
return 0; return 0;
} }