[vlc-devel] [PATCH] packetizer: avparser: fix memory leak

Zhao Zhili quinkblack at foxmail.com
Fri Dec 7 09:28:23 CET 2018


On 2018/12/7 下午3:11, Steve Lhomme wrote:
> On 06/12/2018 14:00, Zhao Zhili wrote:
>> Ping...
>>
>> On 2018/11/26 下午2:52, Zhao Zhili wrote:
>>> Please review, thanks!
>>>
>>> On 2018/11/22 上午10:13, Zhao Zhili wrote:
>>>> ---
>>>>   modules/packetizer/avparser.c | 1 +
>>>>   1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/modules/packetizer/avparser.c 
>>>> b/modules/packetizer/avparser.c
>>>> index 1f911bb..a409e58 100644
>>>> --- a/modules/packetizer/avparser.c
>>>> +++ b/modules/packetizer/avparser.c
>>>> @@ -67,6 +67,7 @@ static void FlushPacketizer( decoder_t *p_dec )
>>>>   {
>>>>       avparser_ClosePacketizer( VLC_OBJECT( p_dec ) );
>>>>       p_dec->p_sys = NULL;
>>>> +    es_format_Clean( &p_dec->fmt_out );
>
> This should be done in avparser_ClosePacketizer() since the copy 
> happens in avparser_OpenPacketizer()

I don't get it. It can be done in Open, Close and Flush. However,

1. Other packetizers don't call es_format_Clean in Open and Close
2. Call es_format_Clean in Open and Close is a waste of time if Open and 
Close are called by module load and unload
3. It's the implementation of Flush leads to the memory leak, so in my 
opinion it makes sense to fix it inside Flush

>
>>>>       int res = avparser_OpenPacketizer( VLC_OBJECT( p_dec ) );
>>>>       if ( res != VLC_SUCCESS )
>>>>       {
>>>
>>
>>
>>
>> _______________________________________________
>> 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



More information about the vlc-devel mailing list