avdevice/dshow_enummediatypes: check return of av_malloc
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>
Mon, 26 Oct 2015 18:49:21 +0000 (14:49 -0400)
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>
Fri, 6 Nov 2015 14:36:57 +0000 (09:36 -0500)
Untested.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
libavdevice/dshow_enummediatypes.c

index 5b69a5b..3a66a4d 100644 (file)
@@ -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 E_OUTOFMEMORY;
             ff_copy_dshow_media_type(type, &this->type);
             *types = type;
             count = 1;