Fix dereference before NULL test (CID 106)
authorRémi Duraffort <ivoire@videolan.org>
Tue, 9 Dec 2008 17:46:41 +0000 (18:46 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 9 Dec 2008 17:46:41 +0000 (18:46 +0100)
modules/mux/mpeg/bits.h

index 407d4ca..0a14e90 100644 (file)
@@ -39,12 +39,12 @@ static inline int bits_initwrite( bits_buffer_t *p_buffer,
     p_buffer->i_data = 0;
     p_buffer->i_mask = 0x80;
     p_buffer->p_data = p_data;
-    p_buffer->p_data[0] = 0;
     if( !p_buffer->p_data )
     {
         if( !( p_buffer->p_data = malloc( i_size ) ) )
             return -1;
     }
+    p_buffer->p_data[0] = 0;
     return 0;
 }