Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 437fb1c87d7b4b0730db97d0858b4f39fffff2a9)
... | ... |
@@ -332,9 +332,7 @@ static void delete_state(DVBSubContext *ctx) |
332 | 332 |
ctx->region_list = region->next; |
333 | 333 |
|
334 | 334 |
delete_region_display_list(ctx, region); |
335 |
- if (region->pbuf) |
|
336 |
- av_free(region->pbuf); |
|
337 |
- |
|
335 |
+ av_free(region->pbuf); |
|
338 | 336 |
av_free(region); |
339 | 337 |
} |
340 | 338 |
|
... | ... |
@@ -1032,8 +1030,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx, |
1032 | 1032 |
buf += 2; |
1033 | 1033 |
|
1034 | 1034 |
if (region->width * region->height != region->buf_size) { |
1035 |
- if (region->pbuf) |
|
1036 |
- av_free(region->pbuf); |
|
1035 |
+ av_free(region->pbuf); |
|
1037 | 1036 |
|
1038 | 1037 |
region->buf_size = region->width * region->height; |
1039 | 1038 |
|
... | ... |
@@ -133,8 +133,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, |
133 | 133 |
/* the block size could change between frames, make sure the buffer |
134 | 134 |
* is large enough, if not, get a larger one */ |
135 | 135 |
if(s->block_size < s->block_width*s->block_height) { |
136 |
- if (s->tmpblock != NULL) |
|
137 |
- av_free(s->tmpblock); |
|
136 |
+ av_free(s->tmpblock); |
|
138 | 137 |
if ((s->tmpblock = av_malloc(3*s->block_width*s->block_height)) == NULL) { |
139 | 138 |
av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); |
140 | 139 |
return -1; |
... | ... |
@@ -243,8 +242,7 @@ static av_cold int flashsv_decode_end(AVCodecContext *avctx) |
243 | 243 |
avctx->release_buffer(avctx, &s->frame); |
244 | 244 |
|
245 | 245 |
/* free the tmpblock */ |
246 |
- if (s->tmpblock != NULL) |
|
247 |
- av_free(s->tmpblock); |
|
246 |
+ av_free(s->tmpblock); |
|
248 | 247 |
|
249 | 248 |
return 0; |
250 | 249 |
} |
... | ... |
@@ -533,12 +533,9 @@ static av_cold int xvid_encode_close(AVCodecContext *avctx) { |
533 | 533 |
av_free(x->twopassbuffer); |
534 | 534 |
av_free(x->old_twopassbuffer); |
535 | 535 |
} |
536 |
- if( x->twopassfile != NULL ) |
|
537 |
- av_free(x->twopassfile); |
|
538 |
- if( x->intra_matrix != NULL ) |
|
539 |
- av_free(x->intra_matrix); |
|
540 |
- if( x->inter_matrix != NULL ) |
|
541 |
- av_free(x->inter_matrix); |
|
536 |
+ av_free(x->twopassfile); |
|
537 |
+ av_free(x->intra_matrix); |
|
538 |
+ av_free(x->inter_matrix); |
|
542 | 539 |
|
543 | 540 |
return 0; |
544 | 541 |
} |
... | ... |
@@ -677,12 +677,9 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
677 | 677 |
for(i = 0; i < 4; i++) { |
678 | 678 |
if(vlc[i].table) |
679 | 679 |
free_vlc(&vlc[i]); |
680 |
- if(h[i].bits) |
|
681 |
- av_free(h[i].bits); |
|
682 |
- if(h[i].lengths) |
|
683 |
- av_free(h[i].lengths); |
|
684 |
- if(h[i].values) |
|
685 |
- av_free(h[i].values); |
|
680 |
+ av_free(h[i].bits); |
|
681 |
+ av_free(h[i].lengths); |
|
682 |
+ av_free(h[i].values); |
|
686 | 683 |
} |
687 | 684 |
|
688 | 685 |
*data_size = unp_size; |
... | ... |
@@ -185,8 +185,7 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) |
185 | 185 |
|
186 | 186 |
static void tm2_free_codes(TM2Codes *code) |
187 | 187 |
{ |
188 |
- if(code->recode) |
|
189 |
- av_free(code->recode); |
|
188 |
+ av_free(code->recode); |
|
190 | 189 |
if(code->vlc.table) |
191 | 190 |
free_vlc(&code->vlc); |
192 | 191 |
} |
... | ... |
@@ -859,13 +858,10 @@ static av_cold int decode_end(AVCodecContext *avctx){ |
859 | 859 |
AVFrame *pic = &l->pic; |
860 | 860 |
int i; |
861 | 861 |
|
862 |
- if(l->last) |
|
863 |
- av_free(l->last); |
|
864 |
- if(l->clast) |
|
865 |
- av_free(l->clast); |
|
862 |
+ av_free(l->last); |
|
863 |
+ av_free(l->clast); |
|
866 | 864 |
for(i = 0; i < TM2_NUM_STREAMS; i++) |
867 |
- if(l->tokens[i]) |
|
868 |
- av_free(l->tokens[i]); |
|
865 |
+ av_free(l->tokens[i]); |
|
869 | 866 |
if(l->Y1){ |
870 | 867 |
av_free(l->Y1); |
871 | 868 |
av_free(l->U1); |
... | ... |
@@ -449,8 +449,7 @@ static int tta_decode_frame(AVCodecContext *avctx, |
449 | 449 |
static av_cold int tta_decode_close(AVCodecContext *avctx) { |
450 | 450 |
TTAContext *s = avctx->priv_data; |
451 | 451 |
|
452 |
- if (s->decode_buffer) |
|
453 |
- av_free(s->decode_buffer); |
|
452 |
+ av_free(s->decode_buffer); |
|
454 | 453 |
av_freep(&s->ch_ctx); |
455 | 454 |
|
456 | 455 |
return 0; |
... | ... |
@@ -111,8 +111,7 @@ static int parse_fmtp_config(AVCodecContext * codec, char *value) |
111 | 111 |
{ |
112 | 112 |
/* decode the hexa encoded parameter */ |
113 | 113 |
int len = ff_hex_to_data(NULL, value); |
114 |
- if (codec->extradata) |
|
115 |
- av_free(codec->extradata); |
|
114 |
+ av_free(codec->extradata); |
|
116 | 115 |
codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); |
117 | 116 |
if (!codec->extradata) |
118 | 117 |
return AVERROR(ENOMEM); |
... | ... |
@@ -334,12 +334,9 @@ static int smacker_read_close(AVFormatContext *s) |
334 | 334 |
int i; |
335 | 335 |
|
336 | 336 |
for(i = 0; i < 7; i++) |
337 |
- if(smk->bufs[i]) |
|
338 |
- av_free(smk->bufs[i]); |
|
339 |
- if(smk->frm_size) |
|
340 |
- av_free(smk->frm_size); |
|
341 |
- if(smk->frm_flags) |
|
342 |
- av_free(smk->frm_flags); |
|
337 |
+ av_free(smk->bufs[i]); |
|
338 |
+ av_free(smk->frm_size); |
|
339 |
+ av_free(smk->frm_flags); |
|
343 | 340 |
|
344 | 341 |
return 0; |
345 | 342 |
} |