[FFmpeg-devel] [PATCH] avdevice/dshow_enummediatypes: check return of av_malloc

Ganesh Ajjanagadde gajjanagadde at gmail.com
Wed Oct 28 01:09:03 CET 2015


Untested.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavdevice/dshow_enummediatypes.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavdevice/dshow_enummediatypes.c b/libavdevice/dshow_enummediatypes.c
index 5b69a5b..5a24870 100644
--- a/libavdevice/dshow_enummediatypes.c
+++ b/libavdevice/dshow_enummediatypes.c
@@ -37,6 +37,8 @@ libAVEnumMediaTypes_Next(libAVEnumMediaTypes *this, unsigned long n,
     if (!this->pos && n == 1) {
         if (!IsEqualGUID(&this->type.majortype, &GUID_NULL)) {
             AM_MEDIA_TYPE *type = av_malloc(sizeof(AM_MEDIA_TYPE));
+            if (!type)
+                return AVERROR(ENOMEM);
             ff_copy_dshow_media_type(type, &this->type);
             *types = type;
             count = 1;
-- 
2.6.2



More information about the ffmpeg-devel mailing list