]> git.sesse.net Git - vlc/commitdiff
Another time : remove useless test before free().
authorRémi Duraffort <ivoire@videolan.org>
Tue, 11 Mar 2008 21:45:04 +0000 (22:45 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 11 Mar 2008 22:02:59 +0000 (23:02 +0100)
18 files changed:
modules/codec/cinepak.c
modules/codec/cmml/cmml.c
modules/codec/dirac.c
modules/codec/dmo/dmo.c
modules/codec/dvbsub.c
modules/codec/ffmpeg/audio.c
modules/codec/ffmpeg/chroma.c
modules/codec/ffmpeg/demux.c
modules/codec/ffmpeg/encoder.c
modules/codec/ffmpeg/postprocess.c
modules/codec/flac.c
modules/codec/png.c
modules/codec/quicktime.c
modules/codec/realaudio.c
modules/codec/speex.c
modules/codec/subtitles/subsass.c
modules/codec/subtitles/subsdec.c
modules/codec/x264.c

index 97f52334996a39cb36c8375b1f76eea474e9834f..68dffcff4a920c587fa1bb544ac8c4ba8d943458 100644 (file)
@@ -209,9 +209,7 @@ static void CloseDecoder( vlc_object_t *p_this )
     msg_Dbg( p_dec, "cinepak decoder stopped" );
 
     for( i = 0; i < 3; i++ )
-    {
-        if( p_sys->context.p_pix[i] ) free( p_sys->context.p_pix[i] );
-    }
+        free( p_sys->context.p_pix[i] );
 
     free( p_sys );
 }
index 2ea083562da5cc659fefe19afc45361a303b3fe4..3cf16dfb56681db0227959c7dd4863ba5db57a92 100644 (file)
@@ -291,10 +291,10 @@ static void ParseText( decoder_t *p_dec, block_t *p_block )
 
     }
 
-    if( psz_subtitle ) free( psz_subtitle );
-    if( psz_cmml ) free( psz_cmml );
-    if( p_anchor ) free( p_anchor );
-    if( p_clip_parser ) free( p_clip_parser );
-    if( psz_url ) free( psz_url );
+    free( psz_subtitle );
+    free( psz_cmml );
+    free( p_anchor );
+    free( p_clip_parser );
+    free( psz_url );
 }
 
index 78d35ba54170881c648bc0dd03930769736d6a4c..dc6edb782e431b946770364575822cb606d0252f 100644 (file)
@@ -133,7 +133,7 @@ static void FreeFrameBuffer( dirac_decoder_t *p_dirac )
         int i;
         for( i = 0; i < 3; i++ )
         {
-            if( p_dirac->fbuf->buf[i] ) free( p_dirac->fbuf->buf[i] );
+            free( p_dirac->fbuf->buf[i] );
             p_dirac->fbuf->buf[i] = 0;
         }
     }
index 624b53659280759e3499c607e451c9e03c4f9221..e6d9ccc9fe4868dda3a34d7c399908b5c41ed6ca 100644 (file)
@@ -556,8 +556,8 @@ static int DecOpen( vlc_object_t *p_this )
     else
         date_Init( &p_sys->end_date, 25 /* FIXME */, 1 );
 
-    if( p_vih ) free( p_vih );
-    if( p_wf ) free( p_wf );
+    free( p_vih );
+    free( p_wf );
 
     return VLC_SUCCESS;
 
@@ -573,9 +573,9 @@ static int DecOpen( vlc_object_t *p_this )
     CoUninitialize();
 #endif /* LOADER */
 
-    if( p_vih ) free( p_vih );
-    if( p_wf )  free( p_wf );
-    if( p_sys ) free( p_sys );
+    free( p_vih );
+    free( p_wf );
+    free( p_sys );
 
     return VLC_EGENERIC;
 }
@@ -771,7 +771,7 @@ void DecoderClose( vlc_object_t *p_this )
     CoUninitialize();
 #endif
 
-    if( p_sys->p_buffer ) free( p_sys->p_buffer );
+    free( p_sys->p_buffer );
     free( p_sys );
 }
 
@@ -1400,7 +1400,7 @@ static int EncOpen( vlc_object_t *p_this )
     CoUninitialize();
 #endif /* LOADER */
 
-    if( p_sys ) free( p_sys );
+    free( p_sys );
 
     return VLC_EGENERIC;
 }
index 15b25090d86cbef20aef684a814801baa0fa5a02..9f182ee781643e1bdb9e0e595c45ec213ddc0b6e 100644 (file)
@@ -870,8 +870,7 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s )
     while( p_region->i_object_defs )
     {
         int i = p_region->i_object_defs - 1;
-        if( p_region->p_object_defs[i].psz_text )
-            free( p_region->p_object_defs[i].psz_text );
+        free( p_region->p_object_defs[i].psz_text );
         if( !i )
             free( p_region->p_object_defs );
 
@@ -999,7 +998,7 @@ static void decode_display_definition( decoder_t *p_dec, bs_t *s )
     }
 
     p_sys->p_display = p_display;
-    if( p_old ) free( p_old );
+    free( p_old );
 
     if( i_processed_length != i_segment_length*8 )
     {
@@ -1413,7 +1412,7 @@ static void free_all( decoder_t *p_dec )
     dvbsub_region_t *p_reg, *p_reg_next;
     dvbsub_clut_t *p_clut, *p_clut_next;
 
-    if( p_sys->p_display ) free( p_sys->p_display );
+    free( p_sys->p_display );
 
     for( p_clut = p_sys->p_cluts; p_clut != NULL; p_clut = p_clut_next )
     {
@@ -1428,10 +1427,9 @@ static void free_all( decoder_t *p_dec )
 
         p_reg_next = p_reg->p_next;
         for( i = 0; i < p_reg->i_object_defs; i++ )
-            if( p_reg->p_object_defs[i].psz_text )
-                free( p_reg->p_object_defs[i].psz_text );
+            free( p_reg->p_object_defs[i].psz_text );
         if( p_reg->i_object_defs ) free( p_reg->p_object_defs );
-        if( p_reg->p_pixbuf ) free( p_reg->p_pixbuf );
+        free( p_reg->p_pixbuf );
         free( p_reg );
     }
     p_sys->p_regions = NULL;
index 4731854d2783115add30c6d4b0060dc9fed0c457..5f4d98934cc67ff1c0c4a091193c7e3f8eb65f7b 100644 (file)
@@ -344,5 +344,5 @@ void E_(EndAudioDec)( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if( p_sys->p_output ) free( p_sys->p_output );
+    free( p_sys->p_output );
 }
index ede4bf8f51f9dd4d11a4530ce1798324b36d6c35..7bdfb25dd93c1a0916c7849e31b96d21761c94b9 100644 (file)
@@ -224,7 +224,7 @@ struct filter_owner_sys_t
 
 static void PictureRelease( picture_t *p_pic )
 {
-    if( p_pic->p_data_orig ) free( p_pic->p_data_orig );
+    free( p_pic->p_data_orig );
 }
 
 static picture_t *video_new_buffer_filter( filter_t *p_filter )
index 36f307eec4b54c74e1e9809e2bdce6cd31518fab..8fcb41536e97c215d7625d544dc2eb4205f525c7 100644 (file)
@@ -280,7 +280,7 @@ void E_(CloseDemux)( vlc_object_t *p_this )
     if( p_sys->ic ) av_close_input_file( p_sys->ic );
     if( !b_avfmt_nofile ) p_sys->fmt->flags ^= AVFMT_NOFILE;
 
-    if( p_sys->io_buffer ) free( p_sys->io_buffer );
+    free( p_sys->io_buffer );
     free( p_sys );
 }
 
index c8021db238ecadb67f8807b631d3896198a2491b..ac00f2f39747a7ff3e78638e9435cc7cccedb104 100644 (file)
@@ -350,7 +350,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
         else
             p_sys->i_hq = FF_MB_DECISION_RD;
     }
-    if( val.psz_string ) free( val.psz_string );
+    else
+        p_sys->i_hq = FF_MB_DECISION_RD;
+    free( val.psz_string );
 
     var_Get( p_enc, ENC_CFG_PREFIX "qmin", &val );
     p_sys->i_qmin = val.i_int;
@@ -1084,8 +1086,8 @@ void E_(CloseEncoder)( vlc_object_t *p_this )
     vlc_mutex_unlock( lock );
     av_free( p_sys->p_context );
 
-    if( p_sys->p_buffer ) free( p_sys->p_buffer );
-    if( p_sys->p_buffer_out ) free( p_sys->p_buffer_out );
+    free( p_sys->p_buffer );
+    free( p_sys->p_buffer_out );
 
     free( p_sys );
 }
index 7a8958d3e5f4b1fb722500dd08658ee68a599563..460fe1bc85cc25585307074fb154f477101c6b90 100644 (file)
@@ -214,7 +214,7 @@ void E_(ClosePostproc)( decoder_t *p_dec, void *p_data )
 
     var_DelCallback( p_dec, "ffmpeg-pp-q", PPQCallback, p_sys );
 
-    if( p_sys ) free( p_sys );
+    free( p_sys );
 }
 
 /*****************************************************************************
index b1b8e883466078998a41d4e4add5aa037f95ed85..f41fd6636561676966977086c97772600f474498 100644 (file)
@@ -316,7 +316,7 @@ static void CloseDecoder( vlc_object_t *p_this )
     FLAC__stream_decoder_delete( p_sys->p_flac );
 #endif
 
-    if( p_sys->p_block ) free( p_sys->p_block );
+    free( p_sys->p_block );
     free( p_sys );
 }
 
@@ -1337,7 +1337,7 @@ static void CloseEncoder( vlc_object_t *p_this )
 
     FLAC__stream_encoder_delete( p_sys->p_flac );
 
-    if( p_sys->p_buffer ) free( p_sys->p_buffer );
+    free( p_sys->p_buffer );
     free( p_sys );
 }
 
index 208fba148fb7d50f3252af75915e30feb9cdcfde..d91168c14800682ea31ba9b14ec9968bfe5771e0 100644 (file)
@@ -234,7 +234,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
  error:
 
-    if( p_row_pointers ) free( p_row_pointers );
+    free( p_row_pointers );
     png_destroy_read_struct( &p_png, &p_info, &p_end_info );
     block_Release( p_block ); *pp_block = NULL;
     return NULL;
index 460abfe012fa60a26e998d07f6d7269c975f0a08..8a85ea7b1a7c0c39774d9213a919707088056c67 100644 (file)
@@ -329,7 +329,7 @@ static void Close( vlc_object_t *p_this )
 
     vlc_mutex_unlock( lock );
 
-    if( p_sys ) free( p_sys );
+    free( p_sys );
 }
 
 /*****************************************************************************
index a00bc0f4a2b25044d76867ac0093fb5e7f781e12..4246a3ad1d53c65f471eb45bb0cc5918ad8bf8cf 100644 (file)
@@ -248,7 +248,7 @@ static void Close( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t*)p_this;
 
     CloseDll( p_dec );
-    if( p_dec->p_sys->p_out ) free( p_dec->p_sys->p_out );
+    free( p_dec->p_sys->p_out );
     free( p_dec->p_sys );
 }
 
index 2548da4c301e7153533f8ef31859f906f49ac05b..9f923a20401788b52cc1058e5ee350be8dc2b7e6 100644 (file)
@@ -804,7 +804,7 @@ static void CloseDecoder( vlc_object_t *p_this )
         speex_bits_destroy( &p_sys->bits );
     }
 
-    if( p_sys->p_header ) free( p_sys->p_header );
+    free( p_sys->p_header );
     free( p_sys );
 }
 
@@ -1031,6 +1031,6 @@ static void CloseEncoder( vlc_object_t *p_this )
     speex_encoder_destroy( p_sys->p_state );
     speex_bits_destroy( &p_sys->bits );
 
-    if( p_sys->p_buffer ) free( p_sys->p_buffer );
+    free( p_sys->p_buffer );
     free( p_sys );
 }
index d8865f92d8d4737d49b4e1359804ae4469b96fd4..3b4337867fe5fed862f99ea48e2e0882df89bfe4 100644 (file)
@@ -121,7 +121,7 @@ void ParseSSAString( decoder_t *p_dec,
         if( !strcmp( p_sys->pp_ssa_styles[i]->psz_stylename, psz_style ) )
             p_style = p_sys->pp_ssa_styles[i];
     }
-    if( psz_style ) free( psz_style );
+    free( psz_style );
 
     p_spu->p_region->psz_text = psz_new_subtitle;
     if( p_style == NULL )
@@ -353,7 +353,7 @@ void ParseSSAHeader( decoder_t *p_dec )
     }
 
 eof:
-    if( psz_header ) free( psz_header );
+    free( psz_header );
     return;
 }
 
index e96b4b5278122c6c308c3890656869adf8e5e4d8..a810d5801990ed115a387bb55e9092eac43eb337 100644 (file)
@@ -283,12 +283,9 @@ static void CloseDecoder( vlc_object_t *p_this )
             if( !p_sys->pp_ssa_styles[i] )
                 continue;
 
-            if( p_sys->pp_ssa_styles[i]->psz_stylename )
-                free( p_sys->pp_ssa_styles[i]->psz_stylename );
-            if( p_sys->pp_ssa_styles[i]->font_style.psz_fontname )
-                free( p_sys->pp_ssa_styles[i]->font_style.psz_fontname );
-            if( p_sys->pp_ssa_styles[i] )
-                free( p_sys->pp_ssa_styles[i] );
+            free( p_sys->pp_ssa_styles[i]->psz_stylename );
+            free( p_sys->pp_ssa_styles[i]->font_style.psz_fontname );
+            free( p_sys->pp_ssa_styles[i] );
         }
         TAB_CLEAN( p_sys->i_ssa_styles, p_sys->pp_ssa_styles );
     }
@@ -302,8 +299,7 @@ static void CloseDecoder( vlc_object_t *p_this )
 
             if( p_sys->pp_images[i]->p_pic )
                 p_sys->pp_images[i]->p_pic->pf_release( p_sys->pp_images[i]->p_pic );
-            if( p_sys->pp_images[i]->psz_filename )
-                free( p_sys->pp_images[i]->psz_filename );
+            free( p_sys->pp_images[i]->psz_filename );
 
             free( p_sys->pp_images[i] );
         }
@@ -401,7 +397,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
     if( !p_spu )
     {
         msg_Warn( p_dec, "can't get spu buffer" );
-        if( psz_subtitle ) free( psz_subtitle );
+        free( psz_subtitle );
         return NULL;
     }
 
@@ -417,7 +413,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
     if( !p_spu->p_region )
     {
         msg_Err( p_dec, "cannot allocate SPU region" );
-        if( psz_subtitle ) free( psz_subtitle );
+        free( psz_subtitle );
         p_dec->pf_spu_buffer_del( p_dec, p_spu );
         return NULL;
     }
@@ -456,7 +452,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
         p_spu->i_original_picture_width = p_sys->i_original_width;
         p_spu->i_original_picture_height = p_sys->i_original_height;
     }
-    if( psz_subtitle ) free( psz_subtitle );
+    free( psz_subtitle );
 
     return p_spu;
 }
index 5f56815603b557cd0fb01ad49ce68d53939a5d4a..ff4ec0cf1c9b0b51ca0fc92704a0bd50bfd49315 100644 (file)
@@ -945,7 +945,7 @@ static int  Open ( vlc_object_t *p_this )
             p_sys->param.analyse.i_me_method = X264_ME_TESA;
         }
     #endif
-    if( val.psz_string ) free( val.psz_string );
+    free( val.psz_string );
 
     var_Get( p_enc, SOUT_CFG_PREFIX "merange", &val );
     if( val.i_int >= 0 && val.i_int <= 64 )
@@ -979,7 +979,7 @@ static int  Open ( vlc_object_t *p_this )
         p_sys->param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_AUTO;
     }
 #endif
-    if( val.psz_string ) free( val.psz_string );
+    free( val.psz_string );
 
     var_Get( p_enc, SOUT_CFG_PREFIX "psnr", &val );
     p_sys->param.analyse.b_psnr = val.b_bool;
@@ -1121,7 +1121,7 @@ static int  Open ( vlc_object_t *p_this )
         p_sys->param.analyse.inter |= X264_ANALYSE_I8x8;
 #endif
     }
-    if( val.psz_string ) free( val.psz_string );
+    free( val.psz_string );
 
 #if X264_BUILD >= 30
     var_Get( p_enc, SOUT_CFG_PREFIX "8x8dct", &val );
@@ -1343,8 +1343,7 @@ static void Close( vlc_object_t *p_this )
     encoder_t     *p_enc = (encoder_t *)p_this;
     encoder_sys_t *p_sys = p_enc->p_sys;
  
-    if( p_sys->psz_stat_name )
-        free( p_sys->psz_stat_name );
+    free( p_sys->psz_stat_name );
 
     x264_encoder_close( p_sys->h );