Commit af5004b5 authored by Michael Niedermayer's avatar Michael Niedermayer

lavc: use av_freep() for freeing extended_data

This is safer
Reviewed-by: 's avatarJustin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 24860a91
...@@ -296,7 +296,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, ...@@ -296,7 +296,7 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
buf, nb_channels, frame->nb_samples, buf, nb_channels, frame->nb_samples,
sample_fmt, align)) < 0) { sample_fmt, align)) < 0) {
if (frame->extended_data != frame->data) if (frame->extended_data != frame->data)
av_free(frame->extended_data); av_freep(&frame->extended_data);
return ret; return ret;
} }
if (frame->extended_data != frame->data) { if (frame->extended_data != frame->data) {
...@@ -334,7 +334,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) ...@@ -334,7 +334,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
if (buf->extended_data[0] && buf_size > buf->audio_data_size) { if (buf->extended_data[0] && buf_size > buf->audio_data_size) {
av_free(buf->extended_data[0]); av_free(buf->extended_data[0]);
if (buf->extended_data != buf->data) if (buf->extended_data != buf->data)
av_free(&buf->extended_data); av_freep(&buf->extended_data);
buf->extended_data = NULL; buf->extended_data = NULL;
buf->data[0] = NULL; buf->data[0] = NULL;
} }
...@@ -1110,7 +1110,7 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, ...@@ -1110,7 +1110,7 @@ int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx,
} }
if (frame && frame->extended_data != frame->data) if (frame && frame->extended_data != frame->data)
av_free(frame->extended_data); av_freep(&frame->extended_data);
return ret ? ret : pkt.size; return ret ? ret : pkt.size;
} }
...@@ -1733,7 +1733,7 @@ static void audio_free_buffers(AVCodecContext *avctx) ...@@ -1733,7 +1733,7 @@ static void audio_free_buffers(AVCodecContext *avctx)
if (buf->extended_data) { if (buf->extended_data) {
av_free(buf->extended_data[0]); av_free(buf->extended_data[0]);
if (buf->extended_data != buf->data) if (buf->extended_data != buf->data)
av_free(buf->extended_data); av_freep(&buf->extended_data);
} }
av_freep(&avci->buffer); av_freep(&avci->buffer);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment