]> git.sesse.net Git - vlc/commitdiff
codec: dmo: avoid null-pointer dereference.
authorFabian Yamaguchi <fyamagu@gwdg.de>
Fri, 5 Dec 2014 14:37:05 +0000 (15:37 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 6 Dec 2014 17:50:18 +0000 (18:50 +0100)
Check the return value of malloc to avoid a null-pointer dereference.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/codec/dmo/dmo.c

index 351ff1987862a1d04ec7b0ea650653d0da5a9b50..25a1f7372a7a4824dfa5bd8e14f449d85353f256 100644 (file)
@@ -1324,6 +1324,9 @@ static int EncoderSetAudioType( encoder_t *p_enc, IMediaObject *p_dmo )
         msg_Dbg( p_enc, "found cbSize: %i", p_wf->cbSize );
         p_enc->fmt_out.i_extra = p_wf->cbSize;
         p_enc->fmt_out.p_extra = malloc( p_enc->fmt_out.i_extra );
+        if( p_enc->fmt_out.p_extra == NULL)
+            return VLC_EGENERIC;
+
         memcpy( p_enc->fmt_out.p_extra, &p_wf[1], p_enc->fmt_out.i_extra );
     }