From 01f4d33b4195c4d95642ac3e548b8d9250b7de1f Mon Sep 17 00:00:00 2001 From: James Almer Date: Sun, 31 Jan 2021 13:05:49 -0300 Subject: avformat/utils: use av_packet_alloc() to allocate packets Signed-off-by: James Almer --- libavformat/options.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libavformat/options.c') diff --git a/libavformat/options.c b/libavformat/options.c index 8d7c4fe4cb..07403b533e 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -221,7 +221,10 @@ AVFormatContext *avformat_alloc_context(void) return NULL; } internal->pkt = av_packet_alloc(); - if (!internal->pkt) { + internal->parse_pkt = av_packet_alloc(); + if (!internal->pkt || !internal->parse_pkt) { + av_packet_free(&internal->pkt); + av_packet_free(&internal->parse_pkt); av_free(internal); av_free(ic); return NULL; -- cgit v1.2.3