[vlc-devel] commit: Check for NULL pointer before using it, not after. ( Antoine Cellerier )

git version control git at videolan.org
Sun Jun 22 16:56:08 CEST 2008


vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Sun Jun 22 14:37:52 2008 +0200| [3223bb48e69376664842115be49c4550c4506eaa]

Check for NULL pointer before using it, not after.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3223bb48e69376664842115be49c4550c4506eaa
---

 modules/video_filter/chain.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/chain.c b/modules/video_filter/chain.c
index efbb066..dd65f08 100644
--- a/modules/video_filter/chain.c
+++ b/modules/video_filter/chain.c
@@ -221,13 +221,13 @@ static picture_t *Chain( filter_t *p_filter, picture_t *p_pic )
     if( !p_sys->p_tmp )
     {
         picture_t *p_tmp = malloc( sizeof( picture_t ) );
+        if( !p_tmp )
+            return NULL;
         vout_AllocatePicture( VLC_OBJECT( p_vout ), p_tmp,
                               p_sys->fmt_mid.i_chroma,
                               p_sys->fmt_mid.i_width,
                               p_sys->fmt_mid.i_height,
                               p_sys->fmt_mid.i_aspect );
-        if( !p_tmp )
-            return NULL;
         p_sys->p_tmp = p_tmp;
         p_tmp->pf_release = NULL;
         p_tmp->i_status = RESERVED_PICTURE;




More information about the vlc-devel mailing list