[FFmpeg-devel] [PATCH] lavc/avpacket: forward av_buffer_realloc() error code.
Nicolas George
george at nsup.org
Sat Jan 4 21:00:05 EET 2020
Fix CID 1457229.
Signed-off-by: Nicolas George <george at nsup.org>
---
libavcodec/avpacket.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 858f827a0a..4da832c53c 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -170,7 +170,7 @@ FF_DISABLE_DEPRECATION_WARNINGS
#define ALLOC_MALLOC(data, size) data = av_malloc(size)
#define ALLOC_BUF(data, size) \
do { \
- av_buffer_realloc(&pkt->buf, size); \
+ ret = av_buffer_realloc(&pkt->buf, size); \
data = pkt->buf ? pkt->buf->data : NULL; \
} while (0)
@@ -197,6 +197,8 @@ do { \
/* Makes duplicates of data, side_data, but does not copy any other fields */
static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
{
+ int ret = AVERROR_BUG;
+
pkt->data = NULL;
pkt->side_data = NULL;
pkt->side_data_elems = 0;
@@ -220,7 +222,8 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
failed_alloc:
av_packet_unref(pkt);
- return AVERROR(ENOMEM);
+ av_assert1(ret != AVERROR_BUG);
+ return ret;
}
int av_copy_packet_side_data(AVPacket *pkt, const AVPacket *src)
--
2.24.1
More information about the ffmpeg-devel
mailing list