[vlc-devel] [PATCH] directx: fix presumed memory leak

Rémi Denis-Courmont remi at remlab.net
Thu Oct 1 09:36:53 CEST 2020


alloca() is worse than VLAs in every possible ways. It's non-standard, it has function scope instead of block scope, and it does not support sizeof().

There's already -Wvla if you want to track VLAs.

Le 1 octobre 2020 10:14:19 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>On 2020-10-01 9:00, Alexandre Janniaux wrote:
>> Hi,
>> 
>> On Thu, Oct 01, 2020 at 07:43:10AM +0200, Steve Lhomme wrote:
>>> It's correct but I think a cleaner way would be to just allocate the
>tables
>>> in the stack like
>>> DXVAHD_VPCAPS capsList[devcaps.VideoProcessorCount];
>> 
>> I'm not sure we want to reintroduce new VLA in the code
>> though. That's not for nothing that it has been relegated
>> into an optional features in C11 and that IIRC compilers
>> like compcert don't want to implement them.
>
>Personally I would use alloca() everywhere so we can try possible stack
>
>overflow sources, but I don't think this policy was agreed on, let
>alone 
>the use of alloca().
>
>>>
>>> MSVC doesn't like these initializations, but I that ship has sailed
>a long
>>> time ago anyway.
>>>
>>> On 2020-09-17 21:18, Lyndon Brown wrote:
>>>> the memory allocations here are released in the error path, but not
>the
>>>> success path, which looks to be a mistake to me...
>>>>
>>>>
>>>> _______________________________________________
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>> 
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20201001/9d992f22/attachment.html>


More information about the vlc-devel mailing list