[FFmpeg-cvslog] avplay: Free frame and graph when memory allocation fails

Federico Tomassetti git at videolan.org
Mon Apr 20 12:45:49 CEST 2015


ffmpeg | branch: master | Federico Tomassetti <f.tomassetti at gmail.com> | Sun Apr 19 11:43:14 2015 +0100| [336d2f0979b43a39bd11a047d798b7990d8b07c6] | committer: Vittorio Giovara

avplay: Free frame and graph when memory allocation fails

Bug-Id: CID 1291564
Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=336d2f0979b43a39bd11a047d798b7990d8b07c6
---

 avplay.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/avplay.c b/avplay.c
index 242b9ae..98fd954 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1580,8 +1580,10 @@ static int video_thread(void *arg)
     AVFilterContext *filt_out = NULL, *filt_in = NULL;
     int last_w = is->video_st->codec->width;
     int last_h = is->video_st->codec->height;
-    if (!graph)
+    if (!graph) {
+        av_frame_free(&frame);
         return AVERROR(ENOMEM);
+    }
 
     if ((ret = configure_video_filters(graph, is, vfilters)) < 0)
         goto the_end;
@@ -1589,8 +1591,12 @@ static int video_thread(void *arg)
     filt_out = is->out_video_filter;
 #endif
 
-    if (!frame)
+    if (!frame) {
+#if CONFIG_AVFILTER
+        avfilter_graph_free(&graph);
+#endif
         return AVERROR(ENOMEM);
+    }
 
     for (;;) {
 #if CONFIG_AVFILTER



More information about the ffmpeg-cvslog mailing list