[vlc-devel] commit: Fix weird NULL checking code. Closes coverity CID 117 (0.8.6 only). (Antoine Cellerier )

git version control git at videolan.org
Fri May 30 14:28:15 CEST 2008


vlc | branch: 0.8.6-bugfix | Antoine Cellerier <dionoea at videolan.org> | Fri May 30 14:29:51 2008 +0200| [e9651457c0eb76d85c059c2b35afcaecd368a126]

Fix weird NULL checking code. Closes coverity CID 117 (0.8.6 only).

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

 modules/mux/mpjpeg.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules/mux/mpjpeg.c b/modules/mux/mpjpeg.c
index 0a16c7d..2dbc9cd 100644
--- a/modules/mux/mpjpeg.c
+++ b/modules/mux/mpjpeg.c
@@ -92,12 +92,19 @@ static int Open( vlc_object_t *p_this )
     psz_separator = var_GetString( p_mux, SOUT_CFG_PREFIX "separator" );
     i_size = strlen( psz_separator ) + 2 + 2 + 2 + strlen( CONTENT_TYPE );
     psz_separator_block = (char*)malloc( i_size );
+
+    if( !psz_separator_block )
+    {
+        free( p_sys );
+        return VLC_ENOMEM;
+    }
+
     sprintf( psz_separator_block, "\r\n%s\r\n%s\r\n", psz_separator,
                                   CONTENT_TYPE );
     p_sys->p_separator = block_New( p_mux, i_size );
     memcpy( p_sys->p_separator->p_buffer, psz_separator_block , i_size );
 
-    if( psz_separator_block ) free( psz_separator_block );
+    free( psz_separator_block );
 
     p_mux->pf_control   = Control;
     p_mux->pf_addstream = AddStream;




More information about the vlc-devel mailing list