avfilter/af_compand: do not leak frames on error

Signed-off-by: Paul B Mahol <onemda@gmail.com>
pull/58/head
Paul B Mahol 11 years ago
parent d601106ab1
commit 709746b6af
  1. 8
      libavfilter/af_compand.c

@ -184,8 +184,10 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)
out_frame = frame; out_frame = frame;
} else { } else {
out_frame = ff_get_audio_buffer(inlink, nb_samples); out_frame = ff_get_audio_buffer(inlink, nb_samples);
if (!out_frame) if (!out_frame) {
av_frame_free(&frame);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
}
av_frame_copy_props(out_frame, frame); av_frame_copy_props(out_frame, frame);
} }
@ -235,8 +237,10 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
if (count >= s->delay_samples) { if (count >= s->delay_samples) {
if (!out_frame) { if (!out_frame) {
out_frame = ff_get_audio_buffer(inlink, nb_samples - i); out_frame = ff_get_audio_buffer(inlink, nb_samples - i);
if (!out_frame) if (!out_frame) {
av_frame_free(&frame);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
}
av_frame_copy_props(out_frame, frame); av_frame_copy_props(out_frame, frame);
out_frame->pts = s->pts; out_frame->pts = s->pts;
s->pts += av_rescale_q(nb_samples - i, (AVRational){1, inlink->sample_rate}, inlink->time_base); s->pts += av_rescale_q(nb_samples - i, (AVRational){1, inlink->sample_rate}, inlink->time_base);

Loading…
Cancel
Save