[FFmpeg-devel] [PATCH 21/50] avformat/matroskadec: use av_packet_alloc() to allocate packets

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Feb 8 18:47:05 EET 2021


James Almer:
> On 2/8/2021 12:22 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> Signed-off-by: James Almer <jamrial at gmail.com>
>>> ---
>>>   libavformat/matroskadec.c | 17 ++++++++++++-----
>>>   1 file changed, 12 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
>>> index 374831baa3..9fad78c78b 100644
>>> --- a/libavformat/matroskadec.c
>>> +++ b/libavformat/matroskadec.c
>>> @@ -365,6 +365,8 @@ typedef struct MatroskaDemuxContext {
>>>       /* byte position of the segment inside the stream */
>>>       int64_t segment_start;
>>>   +    AVPacket *pkt;
>>> +
>>>       /* the packet queue */
>>>       AVPacketList *queue;
>>>       AVPacketList *queue_end;
>>> @@ -2885,6 +2887,10 @@ static int
>>> matroska_read_header(AVFormatContext *s)
>>>       }
>>>       ebml_free(ebml_syntax, &ebml);
>>>   +    matroska->pkt = av_packet_alloc();
>>> +    if (!matroska->pkt)
>>
>> Missing AVERROR(ENOMEM).
> 
> I think at this point i can just return ENOMEM without jumping to fail.

Yes.

- Andreas


More information about the ffmpeg-devel mailing list