[FFmpeg-devel] [PATCH v2 5/5] avcodec/mpegvideo: return more specific error codes for init_duplicate_context()

lance.lmwang at gmail.com lance.lmwang at gmail.com
Thu May 7 14:14:17 EEST 2020


From: Limin Wang <lance.lmwang at gmail.com>

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavcodec/mpegvideo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index b5ddb1b..8a74a45 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -359,7 +359,7 @@ static int init_duplicate_context(MpegEncContext *s)
     int y_size = s->b8_stride * (2 * s->mb_height + 1);
     int c_size = s->mb_stride * (s->mb_height + 1);
     int yc_size = y_size + 2 * c_size;
-    int i;
+    int i, ret = AVERROR(ENOMEM);
 
     if (s->mb_height & 1)
         yc_size += 2*s->b8_stride + 2*s->mb_stride;
@@ -408,7 +408,7 @@ static int init_duplicate_context(MpegEncContext *s)
 
     return 0;
 fail:
-    return -1; // free() through ff_mpv_common_end()
+    return ret; // free() through ff_mpv_common_end()
 }
 
 static void free_duplicate_context(MpegEncContext *s)
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list