[vlc-devel] [PATCH 2/2] compat: tfind: fix a leak in tdelete
Steve Lhomme
robux4 at ycbcr.xyz
Thu Apr 1 14:57:44 UTC 2021
On 2021-04-01 15:49, Rémi Denis-Courmont wrote:
> Le torstaina 1. huhtikuuta 2021, 13.35.00 EEST Steve Lhomme a écrit :
>> In some case the root is reset to NULL (no more elements in the tree) but
>> the root pointer that was allocated in the first tsearch call is not freed
>> in that case.
>
> What is the upstream status if this alleged bug?
I did not find the source of this code.
>> ---
>> compat/tfind.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/compat/tfind.c b/compat/tfind.c
>> index 03382f2aea5..cbb191db2f1 100644
>> --- a/compat/tfind.c
>> +++ b/compat/tfind.c
>> @@ -69,6 +69,8 @@ tdelete(const void* vkey, void** vrootp, int
>> (*compar)(const void*, const void*) }
>> if (p != *rootp)
>> free(*rootp); /* D4: Free node */
>> + else if (q == NULL)
>> + free(*rootp); /* don't leak before
> reset */
>> *rootp = q; /* link parent to
> new node */
>> return p;
>> }
>
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
More information about the vlc-devel
mailing list