diff options
| author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-11 16:17:11 +0100 |
|---|---|---|
| committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-12-11 16:17:11 +0100 |
| commit | ce072469888db55316d648918229f2b83fc5e7cf (patch) | |
| tree | 1d995bd3d70d9a9e341cdd894f14e4cb761ead40 /src/demuxers | |
| parent | 974c78a88db16711f89f50c8e3f5c98dd4a29c02 (diff) | |
| download | xine-lib-ce072469888db55316d648918229f2b83fc5e7cf.tar.gz xine-lib-ce072469888db55316d648918229f2b83fc5e7cf.tar.bz2 | |
Don't use the if(foo) free(foo); construct, as free(NULL); is well defined.
Diffstat (limited to 'src/demuxers')
| -rw-r--r-- | src/demuxers/demux_film.c | 9 | ||||
| -rw-r--r-- | src/demuxers/demux_flv.c | 6 | ||||
| -rw-r--r-- | src/demuxers/demux_iff.c | 107 | ||||
| -rw-r--r-- | src/demuxers/demux_matroska.c | 32 | ||||
| -rw-r--r-- | src/demuxers/demux_real.c | 9 | ||||
| -rw-r--r-- | src/demuxers/demux_realaudio.c | 4 |
6 files changed, 42 insertions, 125 deletions
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c index 26a7a9713..029913846 100644 --- a/src/demuxers/demux_film.c +++ b/src/demuxers/demux_film.c @@ -251,8 +251,7 @@ static int open_film_file(demux_film_t *film) { llprintf(DEBUG_FILM_LOAD, "parsing STAB chunk\n"); /* load the sample table */ - if (film->sample_table) - free(film->sample_table); + free(film->sample_table); film->frequency = _X_BE_32(&film_header[i + 8]); film->sample_count = _X_BE_32(&film_header[i + 12]); film->sample_table = @@ -329,8 +328,7 @@ static int open_film_file(demux_film_t *film) { /* allocate enough space in the interleave preload buffer for the * first chunk (which will be more than enough for successive chunks) */ if (film->audio_type) { - if (film->interleave_buffer) - free(film->interleave_buffer); + free(film->interleave_buffer); film->interleave_buffer = xine_xmalloc(film->sample_table[0].sample_size); } @@ -821,8 +819,7 @@ static int demux_film_seek (demux_plugin_t *this_gen, off_t start_pos, int start static void demux_film_dispose (demux_plugin_t *this_gen) { demux_film_t *this = (demux_film_t *) this_gen; - if (this->sample_table) - free(this->sample_table); + free(this->sample_table); free(this->interleave_buffer); free(this); } diff --git a/src/demuxers/demux_flv.c b/src/demuxers/demux_flv.c index adb29d69d..00b1bb7f5 100644 --- a/src/demuxers/demux_flv.c +++ b/src/demuxers/demux_flv.c @@ -306,8 +306,7 @@ static int parse_flv_var(demux_flv_t *this, num = _X_BE_32(tmp); tmp += 4; if (key && keylen == 5 && !strncmp(key, "times", 5)) { - if (this->index) - free (this->index); + free (this->index); this->index = xine_xcalloc(num, sizeof(flv_index_entry_t)); this->num_indices = num; for (num = 0; num < this->num_indices && tmp < end; num++) { @@ -808,8 +807,7 @@ static int demux_flv_seek (demux_plugin_t *this_gen, static void demux_flv_dispose (demux_plugin_t *this_gen) { demux_flv_t *this = (demux_flv_t *) this_gen; - if (this->index) - free(this->index); + free(this->index); free(this); } diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c index d914405db..7e64e3a98 100644 --- a/src/demuxers/demux_iff.c +++ b/src/demuxers/demux_iff.c @@ -1116,92 +1116,29 @@ static int demux_iff_seek (demux_plugin_t *this_gen, static void demux_iff_dispose (demux_plugin_t *this_gen) { demux_iff_t *this = (demux_iff_t *) this_gen; - if( this->bmhd ) { - free(this->bmhd); - this->bmhd = NULL; - } - if( this->cmap ) { - free( this->cmap ); - this->cmap = NULL; - } - if( this->grab ) { - free(this->grab); - this->grab = NULL; - } - if( this->dest ) { - free(this->dest); - this->dest = NULL; - } - if( this->camg ) { - free(this->camg); - this->camg = NULL; - } - if( this->ccrt ) { - free(this->ccrt); - this->ccrt = NULL; - } - if( this->dpi ) { - free(this->dpi); - this->dpi = NULL; - } + free(this->bmhd); + free(this->cmap); + free(this->grab); + free(this->dest); + free(this->camg); + free(this->ccrt); + free(this->dpi); + free(this->vhdr); + free(this->atak); + free(this->rlse); + free(this->anhd); + free(this->dpan); + + free(this->title); + free(this->copyright); + free(this->author); + free(this->annotations); + free(this->version); + free(this->text); + + free (this->audio_interleave_buffer); + free (this->audio_read_buffer); - if( this->vhdr ) { - free(this->vhdr); - this->vhdr = NULL; - } - if( this->atak ) - { - free( this->atak ); - this->atak = NULL; - } - if( this->rlse ) { - free( this->rlse ); - this->rlse = NULL; - } - - if( this->anhd ) { - free( this->anhd ); - this->anhd = NULL; - } - - if( this->dpan ) { - free( this->dpan ); - this->dpan = NULL; - } - - if( this->title ) { - free (this->title); - this->title = NULL; - } - if( this->copyright ) { - free (this->copyright); - this->copyright = NULL; - } - if( this->author ) { - free (this->author); - this->author = NULL; - } - if( this->annotations ) { - free (this->annotations); - this->annotations = NULL; - } - if( this->version ) { - free (this->version); - this->version = NULL; - } - if( this->text ) { - free (this->text); - this->text = NULL; - } - - if( this->audio_interleave_buffer ) { - free (this->audio_interleave_buffer); - this->audio_interleave_buffer = NULL; - } - if( this->audio_read_buffer ) { - free (this->audio_read_buffer); - this->audio_read_buffer = NULL; - } this->audio_buffer_filled = 0; free(this); diff --git a/src/demuxers/demux_matroska.c b/src/demuxers/demux_matroska.c index 0169651a0..906b9a518 100644 --- a/src/demuxers/demux_matroska.c +++ b/src/demuxers/demux_matroska.c @@ -2672,37 +2672,27 @@ static void demux_matroska_dispose (demux_plugin_t *this_gen) { /* free tracks */ for (i = 0; i < this->num_tracks; i++) { - matroska_track_t *track; + matroska_track_t *const track; track = this->tracks[i]; - if (track->language) - free (track->language); - if (track->codec_id) - free (track->codec_id); - if (track->codec_private) - free (track->codec_private); - if (track->video_track) - free (track->video_track); - if (track->audio_track) - free (track->audio_track); - if (track->sub_track) - free (track->sub_track); + free (track->language); + free (track->codec_id); + free (track->codec_private); + free (track->video_track); + free (track->audio_track); + free (track->sub_track); free (track); } /* Free the cues. */ for (i = 0; i < this->num_indexes; i++) { - if (this->indexes[i].pos) - free(this->indexes[i].pos); - if (this->indexes[i].timecode) - free(this->indexes[i].timecode); + free(this->indexes[i].pos); + free(this->indexes[i].timecode); } - if (this->indexes) - free(this->indexes); + free(this->indexes); /* Free the top_level elem list */ - if (this->top_level_list) - free(this->top_level_list); + free(this->top_level_list); dispose_ebml_parser(this->ebml); free (this); diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c index 60fa91451..99d795fcd 100644 --- a/src/demuxers/demux_real.c +++ b/src/demuxers/demux_real.c @@ -1480,18 +1480,15 @@ static void demux_real_dispose (demux_plugin_t *this_gen) { for(i = 0; i < this->num_video_streams; i++) { real_free_mdpr(this->video_streams[i].mdpr); - if(this->video_streams[i].index) - free(this->video_streams[i].index); + free(this->video_streams[i].index); } for(i = 0; i < this->num_audio_streams; i++) { real_free_mdpr(this->audio_streams[i].mdpr); - if(this->audio_streams[i].index) - free(this->audio_streams[i].index); + free(this->audio_streams[i].index); } - if(this->fragment_tab) - free(this->fragment_tab); + free(this->fragment_tab); free(this); } diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c index 1e7c3c7de..55922371f 100644 --- a/src/demuxers/demux_realaudio.c +++ b/src/demuxers/demux_realaudio.c @@ -297,9 +297,7 @@ static int demux_ra_seek (demux_plugin_t *this_gen, static void demux_ra_dispose (demux_plugin_t *this_gen) { demux_ra_t *this = (demux_ra_t *) this_gen; - if(this->header) - free(this->header); - + free(this->header); free(this); } |
