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

Michael Niedermayer michael at niedermayer.cc
Thu Oct 29 03:00:38 CET 2015


On Tue, Oct 27, 2015 at 08:09:03PM -0400, Ganesh Ajjanagadde wrote:
> 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);

I cannot test this either but the surrounding code returns
E_POINTER, E_OUTOFMEMORY, ...
not AVERROR*
so this does not look correct, or at least inconsistent

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20151029/b77ad5bb/attachment.sig>


More information about the ffmpeg-devel mailing list