[FFmpeg-devel] [PATCH 8/9] ffmpeg: make use of ret error out in transcode_video().

Clément Bœsch ubitux at gmail.com
Wed Feb 8 18:18:31 CET 2012


From: Clément Bœsch <clement.boesch at smartjog.com>

---
 ffmpeg.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 6977e79..56f83f5 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2138,10 +2138,10 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
                 goto cont;
             }
             if (!ist->filtered_frame && !(ist->filtered_frame = avcodec_alloc_frame())) {
-                av_free(buffer_to_free);
-                return AVERROR(ENOMEM);
-            } else
-                avcodec_get_frame_defaults(ist->filtered_frame);
+                ret = AVERROR(ENOMEM);
+                goto end;
+            }
+            avcodec_get_frame_defaults(ist->filtered_frame);
             filtered_frame = ist->filtered_frame;
             *filtered_frame = *decoded_frame; // for me_threshold
             if (ost->picref) {
@@ -2161,6 +2161,7 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int
 #endif
     }
 
+end:
     av_free(buffer_to_free);
     return ret;
 }
-- 
1.7.8.3



More information about the ffmpeg-devel mailing list