]> git.sesse.net Git - vlc/commitdiff
One more removing session. (useless test before a free())
authorRémi Duraffort <ivoire@videolan.org>
Thu, 13 Mar 2008 23:24:00 +0000 (00:24 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 13 Mar 2008 23:28:31 +0000 (00:28 +0100)
13 files changed:
modules/control/http/http.c
modules/control/http/util.c
modules/control/lirc.c
modules/control/ntservice.c
modules/demux/flac.c
modules/demux/mjpeg.c
modules/demux/mp4/libmp4.c
modules/demux/nuv.c
modules/demux/playlist/itml.h
modules/demux/playlist/pls.c
modules/demux/subtitle_asa.c
modules/demux/ts.c
modules/demux/ty.c

index 6a0e593de2a4e7c560262c8fd38c1eb08f1f9163..ff46c7d4d5d54c6379420265d31f573f693f33fe 100644 (file)
@@ -201,8 +201,7 @@ static int Open( vlc_object_t *p_this )
             TAB_APPEND( p_sys->i_handlers, p_sys->pp_handlers, p_handler );
         }
     }
-    if( psz_src != NULL )
-        free( psz_src );
+    free( psz_src );
 #endif
 
     /* determine SSL configuration */
@@ -275,11 +274,8 @@ static int Open( vlc_object_t *p_this )
         };
         unsigned i;
 
-        if( psz_src != NULL )
-        {
-            free( psz_src );
-            psz_src = NULL;
-        }
+        free( psz_src );
+        psz_src = NULL;
 
         for( i = 0; ppsz_paths[i] != NULL; i++ )
             if( !DirectoryCheck( ppsz_paths[i] ) )
@@ -372,10 +368,7 @@ static void Close ( vlc_object_t *p_this )
         free( p_sys->pp_files[i]->name );
         free( p_sys->pp_files[i] );
     }
-    if( p_sys->pp_files )
-    {
-        free( p_sys->pp_files );
-    }
+    free( p_sys->pp_files );
     for( i = 0; i < p_sys->i_handlers; i++ )
     {
         http_association_t *p_handler = p_sys->pp_handlers[i];
@@ -794,8 +787,7 @@ int  E_(HandlerCallback)( httpd_handler_sys_t *p_args,
                 NULL );
     TAB_REMOVE( p_args->p_association->i_argc, p_args->p_association->ppsz_argv,
                 psz_file );
-    if( psz_cwd != NULL )
-        free( psz_cwd );
+    free( psz_cwd );
     while( i_env )
         TAB_REMOVE( i_env, ppsz_env, ppsz_env[0] );
 
index a6a2a2784683f010b1b9bc6ab3aac07ce1862287..564ab4a35806c741cd56a04189f516520ea40dd0 100644 (file)
@@ -328,14 +328,8 @@ int E_(ParseDirectory)( intf_thread_t *p_intf, char *psz_root,
         }
     }
 
-    if( user )
-    {
-        free( user );
-    }
-    if( password )
-    {
-        free( password );
-    }
+    free( user );
+    free( password );
 
     ACL_Destroy( p_acl );
     closedir( p_dir );
index 67cd2962ed4b5e52a36bb9eb474953c45be30bae..0957985e1ea46592e8400c6b1f2dfb48244a8399 100644 (file)
@@ -123,8 +123,7 @@ static void Close( vlc_object_t *p_this )
     intf_thread_t *p_intf = (intf_thread_t *)p_this;
 
     /* Destroy structure */
-    if( p_intf->p_sys->psz_file )
-        free( p_intf->p_sys->psz_file );
+    free( p_intf->p_sys->psz_file );
     lirc_freeconfig( p_intf->p_sys->config );
     lirc_deinit();
     free( p_intf->p_sys );
index b8b567bf8b5b65f0223ab224f513208e9a182726..4d52d14a84521928d7f30d6162925fc460c3f2c1 100644 (file)
@@ -196,7 +196,7 @@ static int NTServiceInstall( intf_thread_t *p_intf )
         strcat( psz_path, " --ntservice-extraintf " );
         strcat( psz_path, psz_extra );
     }
-    if( psz_extra ) free( psz_extra );
+    free( psz_extra );
 
     psz_extra = config_GetPsz( p_intf, "ntservice-options" );
     if( psz_extra && *psz_extra )
@@ -204,7 +204,7 @@ static int NTServiceInstall( intf_thread_t *p_intf )
         strcat( psz_path, " " );
         strcat( psz_path, psz_extra );
     }
-    if( psz_extra ) free( psz_extra );
+    free( psz_extra );
 
     SC_HANDLE service =
         CreateService( handle, p_sys->psz_service, p_sys->psz_service,
@@ -338,10 +338,7 @@ static void WINAPI ServiceDispatch( DWORD numArgs, char **args )
             free( psz_temp );
         }
     }
-    if( psz_modules )
-    {
-        free( psz_modules );
-    }
+    free( psz_modules );
 
     /* Initialization complete - report running status */
     p_sys->status.dwCurrentState = SERVICE_RUNNING;
index 9be5869b68e10b6436374c14eae935c0d8adb282..756573d29234a2fd9833776e1b21b819e73f8246 100644 (file)
@@ -150,8 +150,7 @@ static int Open( vlc_object_t * p_this )
         module_Need( p_sys->p_packetizer, "packetizer", NULL, 0 );
     if( !p_sys->p_packetizer->p_module )
     {
-        if( p_sys->p_packetizer->fmt_in.p_extra )
-            free( p_sys->p_packetizer->fmt_in.p_extra );
+        free( p_sys->p_packetizer->fmt_in.p_extra );
         vlc_object_release( p_sys->p_packetizer );
 
         msg_Err( p_demux, "cannot find flac packetizer" );
@@ -189,8 +188,7 @@ static void Close( vlc_object_t * p_this )
     /* Unneed module */
     module_Unneed( p_sys->p_packetizer, p_sys->p_packetizer->p_module );
 
-    if( p_sys->p_packetizer->fmt_in.p_extra )
-        free( p_sys->p_packetizer->fmt_in.p_extra );
+    free( p_sys->p_packetizer->fmt_in.p_extra );
 
     /* Delete the decoder */
     vlc_object_release( p_sys->p_packetizer );
@@ -712,10 +710,8 @@ static void ParsePicture( demux_t *p_demux, const uint8_t *p_data, int i_data )
         p_sys->i_cover_score = pi_cover_score[i_type];
     }
 error:
-    if( psz_mime )
-        free( psz_mime );
-    if( psz_description )
-        free( psz_description );
+    free( psz_mime );
+    free( psz_description );
 }
 #undef RM
 
index c3e77e8f823ac6b983adb798d5fca3178c931361..c7096ed2b96bca5b2b06953cdc4f057dad5f0922 100644 (file)
@@ -511,10 +511,7 @@ static void Close ( vlc_object_t * p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys  = p_demux->p_sys;
 
-    if( p_sys->psz_separator )
-    {
-        free( p_sys->psz_separator );
-    }
+    free( p_sys->psz_separator );
     free( p_sys );
 }
 
index a8af7fd5e346abfdb357c50bcd4b861a94291411..b28a98962271bb7b4b342dbae6f72479f951dbe7 100644 (file)
@@ -1208,8 +1208,7 @@ static int MP4_ReadBox_sample_soun( stream_t *p_stream, MP4_Box_t *p_box )
 
     if( p_box->i_type == FOURCC_alac )
     {
-        if( p_box->data.p_sample_soun->p_qt_description )
-            free( p_box->data.p_sample_soun->p_qt_description );
+        free( p_box->data.p_sample_soun->p_qt_description );
 
         p_box->data.p_sample_soun->p_qt_description = malloc( i_read );
         p_box->data.p_sample_soun->i_qt_description = i_read;
index 5b41cd8294755787ded0324dc0b938f7877f0137..4856c8636df94f288dfaac016ac2ebfa983aaab3 100644 (file)
@@ -316,8 +316,7 @@ static void Close( vlc_object_t * p_this )
     demux_t        *p_demux = (demux_t*)p_this;
     demux_sys_t    *p_sys = p_demux->p_sys;
 
-    if( p_sys->p_extra_f )
-        free( p_sys->p_extra_f );
+    free( p_sys->p_extra_f );
     demux_IndexClean( &p_sys->idx );
     free( p_sys );
 }
@@ -644,11 +643,8 @@ static void demux_IndexInit( demux_index_t *p_idx )
 }
 static void demux_IndexClean( demux_index_t *p_idx )
 {
-    if( p_idx->idx )
-    {
-        free( p_idx->idx );
-        p_idx->idx = NULL;
-    }
+    free( p_idx->idx );
+    p_idx->idx = NULL;
 }
 static void demux_IndexAppend( demux_index_t *p_idx,
                                int64_t i_time, int64_t i_offset )
index b1514345f6a63df379276ef28cff81c451b5c4e5..4042a96d882e80f405f83bdce1d77d428ad52b42 100644 (file)
  */
 
 /* defines */
-#define FREE(v)        if (v) {free(v);v=NULL;}
-#define FREE_NAME()    if (psz_name) {free(psz_name);psz_name=NULL;}
-#define FREE_VALUE()   if (psz_value) {free(psz_value);psz_value=NULL;}
-#define FREE_KEY()     if (psz_key) {free(psz_key);psz_key=NULL;}
+#define FREE(v)        free(v);v=NULL;
+#define FREE_NAME()    free(psz_name);psz_name=NULL;
+#define FREE_VALUE()   free(psz_value);psz_value=NULL;
+#define FREE_KEY()     free(psz_key);psz_key=NULL;
 #define FREE_ATT()     FREE_NAME();FREE_VALUE()
 #define FREE_ATT_KEY() FREE_NAME();FREE_VALUE();FREE_KEY()
 
index 649be46f6f22ae6d1ea7caac14a011baa4910f60..7006b49a023a9a6843eb01d24dd2bacdeace3db0 100644 (file)
@@ -73,10 +73,7 @@ int E_(Import_PLS)( vlc_object_t *p_this )
 void E_(Close_PLS)( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t *)p_this;
-    if( p_demux->p_sys->psz_prefix )
-    {
-        free( p_demux->p_sys->psz_prefix );
-    }
+    free( p_demux->p_sys->psz_prefix );
     free( p_demux->p_sys );
 }
 
@@ -172,11 +169,8 @@ static int Demux( demux_t *p_demux )
             {
                 msg_Warn( p_demux, "no file= part found for item %d", i_item );
             }
-            if( psz_name )
-            {
-                free( psz_name );
-                psz_name = NULL;
-            }
+            free( psz_name );
+            psz_name = NULL;
             i_duration = -1;
             i_item = i_new_item;
             i_new_item = 0;
@@ -184,8 +178,7 @@ static int Demux( demux_t *p_demux )
         if( !strncasecmp( psz_key, "file", sizeof("file") -1 ) ||
             !strncasecmp( psz_key, "Ref", sizeof("Ref") -1 ) )
         {
-            if( psz_mrl_orig )
-                free( psz_mrl_orig );
+            free( psz_mrl_orig );
             psz_mrl_orig =
             psz_mrl = E_(ProcessMRL)( psz_value, p_demux->p_sys->psz_prefix );
 
@@ -202,8 +195,7 @@ static int Demux( demux_t *p_demux )
         }
         else if( !strncasecmp( psz_key, "title", sizeof("title") -1 ) )
         {
-            if( psz_name )
-                free( psz_name );
+            free( psz_name );
             psz_name = strdup( psz_value );
         }
         else if( !strncasecmp( psz_key, "length", sizeof("length") -1 ) )
@@ -234,11 +226,8 @@ static int Demux( demux_t *p_demux )
     {
         msg_Warn( p_demux, "no file= part found for item %d", i_item );
     }
-    if( psz_name )
-    {
-        free( psz_name );
-        psz_name = NULL;
-    }
+    free( psz_name );
+    psz_name = NULL;
 
     HANDLE_PLAY_AND_RELEASE;
     return 0; /* Needed for correct operation of go back */
index 99f091310bf535df69f18279a4b5f8b2e6c8221c..0d3f67005f6d73f533b8502f5a44e0acd15d9651 100644 (file)
@@ -310,12 +310,8 @@ static void Close( vlc_object_t *p_this )
     int i;
 
     for( i = 0; i < p_sys->i_subtitles; i++ )
-    {
-        if( p_sys->subtitle[i].psz_text )
-            free( p_sys->subtitle[i].psz_text );
-    }
-    if( p_sys->subtitle )
-        free( p_sys->subtitle );
+        free( p_sys->subtitle[i].psz_text );
+    free( p_sys->subtitle );
 
     free( p_sys );
 }
index becc5b7f7be387cdb19498cf18170840ae993bae..bf78f9783d91b1a245d55ed0602bd028f67d3a9d 100644 (file)
@@ -2399,12 +2399,9 @@ static void IODFree( iod_descriptor_t *p_iod )
             }
             else
             {
-                if( es_descr.dec_descr.p_decoder_specific_info != NULL )
-                {
-                    free( es_descr.dec_descr.p_decoder_specific_info );
-                    es_descr.dec_descr.p_decoder_specific_info = NULL;
-                    es_descr.dec_descr.i_decoder_specific_info_len = 0;
-                }
+                free( es_descr.dec_descr.p_decoder_specific_info );
+                es_descr.dec_descr.p_decoder_specific_info = NULL;
+                es_descr.dec_descr.i_decoder_specific_info_len = 0;
             }
         }
         es_descr.b_ok = 0;
index 51e8a05995bd57c0621fe21967fa84ae6827165a..04547b1b840bc20131a3c54636f85ba7613b424d 100644 (file)
@@ -545,8 +545,7 @@ static void Close( vlc_object_t *p_this )
     XdsExit( &p_sys->xds );
     cc_Exit( &p_sys->cc );
     free( p_sys->rec_hdrs );
-    if( p_sys->seq_table )
-        free( p_sys->seq_table );
+    free( p_sys->seq_table );
     free(p_sys);
 }
 
@@ -1127,23 +1126,16 @@ static void XdsInit( xds_t *h )
 static void XdsExit( xds_t *h )
 {
     /* */
-    if( h->meta.psz_channel_name )
-        free( h->meta.psz_channel_name );
-    if( h->meta.psz_channel_call_letter )
-        free( h->meta.psz_channel_call_letter );
-    if( h->meta.psz_channel_number )
-        free( h->meta.psz_channel_number );
+    free( h->meta.psz_channel_name );
+    free( h->meta.psz_channel_call_letter );
+    free( h->meta.psz_channel_number );
 
     /* */
-    if( h->meta.current.psz_name )
-        free( h->meta.current.psz_name );
-    if( h->meta.current.psz_rating )
-        free( h->meta.current.psz_rating );
+    free( h->meta.current.psz_name );
+    free( h->meta.current.psz_rating );
     /* */
-    if( h->meta.future.psz_name )
-        free( h->meta.future.psz_name );
-    if( h->meta.future.psz_rating )
-        free( h->meta.future.psz_rating );
+    free( h->meta.future.psz_name );
+    free( h->meta.future.psz_rating );
 }
 static void XdsStringUtf8( char dst[2*32+1], const uint8_t *p_src, int i_src )
 {
@@ -1179,8 +1171,7 @@ static vlc_bool_t XdsChangeString( xds_t *h, char **ppsz_dst, const char *psz_ne
     if( *ppsz_dst == NULL && psz_new == NULL )
         return VLC_FALSE;
 
-    if( *ppsz_dst )
-        free( *ppsz_dst );
+    free( *ppsz_dst );
     if( psz_new )
         *ppsz_dst = strdup( psz_new );
     else
@@ -1641,8 +1632,7 @@ static void parse_master(demux_t *p_demux)
        entire table directly from the stream into memory in place. */
 
     /* clear the SEQ table */
-    if (p_sys->seq_table != NULL)
-        free(p_sys->seq_table);
+    free(p_sys->seq_table);
     
     /* parse header info */
     stream_Read(p_demux->s, mst_buf, 32);
@@ -1900,8 +1890,7 @@ static int get_chunk_header(demux_t *p_demux)
   
     /*msg_Dbg( p_demux, "chunk has %d records", i_num_recs );*/
 
-    if (p_sys->rec_hdrs)
-        free(p_sys->rec_hdrs);
+    free(p_sys->rec_hdrs);
 
     /* skip past the 4 bytes we "peeked" earlier */
     stream_Read( p_demux->s, NULL, 4 );