]> git.sesse.net Git - vlc/commitdiff
Useless test before a free()
authorRémi Duraffort <ivoire@videolan.org>
Thu, 13 Mar 2008 23:21:34 +0000 (00:21 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 13 Mar 2008 23:28:31 +0000 (00:28 +0100)
modules/access/mms/buffer.c
modules/access/mms/mmsh.c
modules/access/mms/mmstu.c
modules/access/pvr.c
modules/access/rtsp/real_asmrp.c
modules/audio_output/jack.c
modules/codec/cc.c
modules/codec/cmml/xtag.c
modules/codec/faad.c
modules/codec/fake.c

index 726ba544e0f9fe7f654a1c063c90b248d1b1a0b1..5cc2c503faababe78b92d26b16e87462dc2e832f 100644 (file)
@@ -54,10 +54,7 @@ int var_buffer_reinitwrite( var_buffer_t *p_buf, int i_default_size )
     if( p_buf->i_size < i_default_size )
     {
         p_buf->i_size = i_default_size;
-        if( p_buf->p_data )
-        {
-            free( p_buf->p_data );
-        }
+        free( p_buf->p_data );
         p_buf->p_data = malloc( p_buf->i_size );
     }
     if( !p_buf->p_data )
@@ -151,10 +148,7 @@ void var_buffer_addUTF16( var_buffer_t *p_buf, const char *p_str )
 
 void var_buffer_free( var_buffer_t *p_buf )
 {
-    if( p_buf->p_data )
-    {
-        free( p_buf->p_data );
-    }
+    free( p_buf->p_data );
     p_buf->i_data = 0;
     p_buf->i_size = 0;
 }
index c2a2c24342711b950384b0778757a015fa226841..cc22555931ff76a3f9b6a0538a2f50784e5f11bd 100644 (file)
@@ -226,8 +226,7 @@ void E_( MMSHClose )( access_t *p_access )
 
     Stop( p_access );
 
-    if( p_sys->p_header )
-        free( p_sys->p_header  );
+    free( p_sys->p_header  );
 
     vlc_UrlClean( &p_sys->proxy );
     vlc_UrlClean( &p_sys->url );
@@ -732,8 +731,7 @@ static void GetHeader( access_t *p_access )
 
     /* Read the asf header */
     p_sys->i_header = 0;
-    if( p_sys->p_header )
-        free( p_sys->p_header  );
+    free( p_sys->p_header  );
     p_sys->p_header = NULL;
     for( ;; )
     {
index 5f5534e09f317532e3d202b0f1ae04226248fa19..3779a065ea1bded6310a28c7e11ee79b523a7b36 100644 (file)
@@ -1099,10 +1099,7 @@ static int  mms_ParseCommand( access_t *p_access,
     int         i_length;
     uint32_t    i_id;
 
-    if( p_sys->p_cmd )
-    {
-        free( p_sys->p_cmd );
-    }
+    free( p_sys->p_cmd );
     p_sys->i_cmd = i_data;
     p_sys->p_cmd = malloc( i_data );
     memcpy( p_sys->p_cmd, p_data, i_data );
index 94f4fcbd42aa04a2c1f777b36482174d7d5f0e9a..848276bb9b3498934d1327d5d01e6f458e2e08f6 100644 (file)
@@ -826,8 +826,7 @@ static int Open( vlc_object_t * p_this )
 
     if( psz_device )
     {
-        if( p_sys->psz_videodev )
-            free( p_sys->psz_videodev );
+        free( p_sys->psz_videodev );
         p_sys->psz_videodev = psz_device;
     }
 
@@ -1061,10 +1060,8 @@ static void Close( vlc_object_t * p_this )
         close( p_sys->i_fd );
     if ( p_sys->i_radio_fd != -1 )
         close( p_sys->i_radio_fd );
-    if ( p_sys->psz_videodev )
-        free( p_sys->psz_videodev );
-    if ( p_sys->psz_radiodev )
-        free( p_sys->psz_radiodev );
+    free( p_sys->psz_videodev );
+    free( p_sys->psz_radiodev );
     free( p_sys );
 }
 
index c909310e718165cab12608fb3d4c70f88f94b217..c37363feae7a6ee390e7e7f991e176b634bd3658 100644 (file)
@@ -106,8 +106,8 @@ static void asmrp_dispose (asmrp_t *p) {
   for (i=0; i<p->sym_tab_num; i++)
     free (p->sym_tab[i].id);
 
-  if (p->buf) free (p->buf);
-  free (p);
+  free( p->buf );
+  free( p );
 }
 
 static void asmrp_getch (asmrp_t *p) {
index 681338d175640fafba62486605bbf6da801c2e30..696aa9aa3c65746b59abadf1bb2d3fa9432e16ba 100644 (file)
@@ -214,10 +214,7 @@ static int Open( vlc_object_t *p_this )
                          psz_out, psz_in );
             }
         }
-        if( pp_in_ports )
-        {
-            free( pp_in_ports );
-        }
+        free( pp_in_ports );
     }
 
     msg_Dbg( p_aout, "JACK audio output initialized (%d channels, buffer "
@@ -233,14 +230,8 @@ error_out:
             jack_deactivate( p_sys->p_jack_client );
             jack_client_close( p_sys->p_jack_client );
         }
-        if( p_sys->p_jack_ports )
-        {
-            free( p_sys->p_jack_ports );
-        }
-        if( p_sys->p_jack_buffers )
-        {
-            free( p_sys->p_jack_buffers );
-        }
+        free( p_sys->p_jack_ports );
+        free( p_sys->p_jack_buffers );
         free( p_sys );
     }
     return status;
index 0e62866dc264f81dbfd29fb73a33d18a19f1b047..aca7a30e22df686b7aa8449703e638cfd2062a77 100644 (file)
@@ -334,8 +334,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
     {
         msg_Warn( p_dec, "can't get spu buffer" );
         free( psz_subtitle );
-        if( psz_html )
-            free( psz_html );
+        free( psz_html );
         return NULL;
     }
 
@@ -352,8 +351,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
     {
         msg_Err( p_dec, "cannot allocate SPU region" );
         free( psz_subtitle );
-        if( psz_html )
-            free( psz_html );
+        free( psz_html );
         p_dec->pf_spu_buffer_del( p_dec, p_spu );
         return NULL;
     }
index 024e1e93387e8e9f27631ec38f066a70a7d55827..812e280a264e5fe3a9a2b725fd80a512222d49a9 100644 (file)
@@ -421,14 +421,14 @@ xtag_free (XTag * xtag)
 
   if (xtag == NULL) return NULL;
 
-  if (xtag->name) free (xtag->name);
-  if (xtag->pcdata) free (xtag->pcdata);
+  free( xtag->name );
+  free( xtag->pcdata );
 
   for (l = xtag->attributes; l; l = l->next) {
     if ((attr = (XAttribute *)l->data) != NULL) {
-      if (attr->name) free (attr->name);
-      if (attr->value) free (attr->value);
-      free (attr);
+      free( attr->name );
+      free( attr->value );
+      free( attr );
     }
   }
   xlist_free (xtag->attributes);
index 054e1df1a4cdb6dd4bdea96ba2eb40b0aa544291..69100cc48fc51e3226549f27ed547193177980bc 100644 (file)
@@ -434,7 +434,7 @@ static void Close( vlc_object_t *p_this )
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     faacDecClose( p_sys->hfaad );
-    if( p_sys->p_buffer ) free( p_sys->p_buffer );
+    free( p_sys->p_buffer );
     free( p_sys );
 }
 
index 3aa7a6255204461ccda1267dd0636566f7060926..3861c51c9aca45b8ee0ba25b3c45c81944068e81 100644 (file)
@@ -225,7 +225,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     }
     msg_Dbg( p_dec, "file %s loaded successfully", psz_file );
 
-    if ( psz_file ) free( psz_file );
+    free( psz_file );
 
     if ( b_keep_ar )
     {
@@ -304,7 +304,7 @@ static int OpenDecoder( vlc_object_t *p_this )
         p_handler = image_HandlerCreate( p_dec );
         p_image = image_Filter( p_handler, p_old, &fmt_out, val.psz_string );
         image_HandlerDelete( p_handler );
-        if ( val.psz_string != NULL ) free( val.psz_string );
+        free( val.psz_string );
 
         if ( p_image == NULL )
         {