summaryrefslogtreecommitdiffstats
path: root/test/test.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-01-06 17:35:02 +0000
committerRodeo <[email protected]>2013-01-06 17:35:02 +0000
commit1e2f4aa1583cda216991d21adcc40f8c3558b0fe (patch)
tree918a0e51a2dc1d9fde185f90277108edf8f1b720 /test/test.c
parent576e69efbdb7271292af5b37f9927bcc15e537a6 (diff)
CLI: check against NULL before freeing.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5156 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/test/test.c b/test/test.c
index c91ccaf2c..2e93b88ee 100644
--- a/test/test.c
+++ b/test/test.c
@@ -339,44 +339,45 @@ int main( int argc, char ** argv )
}
/* Clean up */
- hb_close( &h );
+ hb_close(&h);
hb_global_close();
- if( input ) free( input );
- if( output ) free( output );
- if( format ) free( format );
- if( audios )
+ if (audios != NULL)
{
- while( ( audio = hb_list_item( audios, 0 ) ) )
+ while ((audio = hb_list_item(audios, 0)) != NULL)
{
- hb_list_rem( audios, audio );
- if( audio->out.name )
+ hb_list_rem(audios, audio);
+ if (audio->out.name != NULL)
{
- free( audio->out.name );
+ free(audio->out.name);
}
- free( audio );
+ free(audio);
}
- hb_list_close( &audios );
+ hb_list_close(&audios);
}
- if( mixdowns ) free( mixdowns );
- if( dynamic_range_compression ) free( dynamic_range_compression );
- if( audio_gain ) free( audio_gain );
- if( atracks ) free( atracks );
- if( arates ) free( arates );
- str_vfree( abitrates );
- str_vfree( aqualities );
- str_vfree( acompressions );
- if( acodecs ) free( acodecs );
- if (native_language ) free (native_language );
- if( advanced_opts ) free (advanced_opts );
- if (preset_name) free (preset_name);
- free( x264_profile );
- free( x264_preset );
- free( x264_tune );
- free( h264_level );
-
- // write a carriage return to stdout - avoids overlap / line wrapping when stderr is redirected
- fprintf( stdout, "\n" );
- fprintf( stderr, "HandBrake has exited.\n" );
+ if (abitrates != NULL) str_vfree(abitrates);
+ if (acompressions != NULL) str_vfree(acompressions);
+ if (aqualities != NULL) str_vfree(aqualities);
+ if (acodecs != NULL) free(acodecs);
+ if (arates != NULL) free(arates);
+ if (atracks != NULL) free(atracks);
+ if (audio_gain != NULL) free(audio_gain);
+ if (dynamic_range_compression != NULL) free(dynamic_range_compression);
+ if (mixdowns != NULL) free(mixdowns);
+ if (native_language != NULL) free(native_language);
+ if (format != NULL) free(format);
+ if (input != NULL) free(input);
+ if (output != NULL) free(output);
+ if (preset_name != NULL) free(preset_name);
+ if (x264_preset != NULL) free(x264_preset);
+ if (x264_tune != NULL) free(x264_tune);
+ if (advanced_opts != NULL) free(advanced_opts);
+ if (x264_profile != NULL) free(x264_profile);
+ if (h264_level != NULL) free(h264_level);
+
+ // write a carriage return to stdout
+ // avoids overlap / line wrapping when stderr is redirected
+ fprintf(stdout, "\n");
+ fprintf(stderr, "HandBrake has exited.\n");
return 0;
}