[FFmpeg-cvslog] lavfi/sendcmd: release file in case of failed allocation

Stefano Sabatini git at videolan.org
Tue Oct 23 22:14:00 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Tue Oct 23 01:42:24 2012 +0200| [c7065f1f8953a73fe6eeaeb0cdb8adb5dbe99265] | committer: Stefano Sabatini

lavfi/sendcmd: release file in case of failed allocation

Avoid hanging file.

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

 libavfilter/f_sendcmd.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
index 7081de8..9f17045 100644
--- a/libavfilter/f_sendcmd.c
+++ b/libavfilter/f_sendcmd.c
@@ -398,8 +398,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
 
         /* create a 0-terminated string based on the read file */
         buf = av_malloc(file_bufsize + 1);
-        if (!buf)
+        if (!buf) {
+            av_file_unmap(file_buf, file_bufsize);
             return AVERROR(ENOMEM);
+        }
         memcpy(buf, file_buf, file_bufsize);
         buf[file_bufsize] = 0;
         av_file_unmap(file_buf, file_bufsize);



More information about the ffmpeg-cvslog mailing list