[FFmpeg-cvslog] avconv_hw: Free device on initialisation failure

Mark Thompson git at videolan.org
Sun Jun 18 19:14:21 EEST 2017


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Fri Jun 16 23:18:55 2017 +0100| [f434ddf48e084a7a5631e7a9dd1d9771d97e114c] | committer: Mark Thompson

avconv_hw: Free device on initialisation failure

Fixes CID 1412852.

(cherry picked from commit c2b0bea40f1fd4399ff6184a2df4f397c0f4b3ab)

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

 ffmpeg_hw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ffmpeg_hw.c b/ffmpeg_hw.c
index 5708e9af20..a4d1cada59 100644
--- a/ffmpeg_hw.c
+++ b/ffmpeg_hw.c
@@ -77,7 +77,7 @@ int hw_device_init_from_string(const char *arg, HWDevice **dev_out)
     char *type_name = NULL, *name = NULL, *device = NULL;
     enum AVHWDeviceType type;
     HWDevice *dev, *src;
-    AVBufferRef *device_ref;
+    AVBufferRef *device_ref = NULL;
     int err;
     const char *errmsg, *p, *q;
     size_t k;
@@ -210,6 +210,7 @@ invalid:
 fail:
     av_log(NULL, AV_LOG_ERROR,
            "Device creation failed: %d.\n", err);
+    av_buffer_unref(&device_ref);
     goto done;
 }
 



More information about the ffmpeg-cvslog mailing list