Commit 87e625c2 authored by James Almer's avatar James Almer

avcodec/encode: do proper cleanup on failure

Fixes the last remaining memleaks introduced by a22c6a47.
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent ef973bd9
......@@ -225,9 +225,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
} else if (!avpkt->buf) {
AVPacket tmp = { 0 };
ret = av_packet_ref(&tmp, avpkt);
if (ret < 0)
return ret;
av_packet_unref(avpkt);
if (ret < 0)
goto end;
*avpkt = tmp;
}
}
......@@ -324,9 +324,9 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
} else if (!avpkt->buf) {
AVPacket tmp = { 0 };
ret = av_packet_ref(&tmp, avpkt);
av_packet_unref(avpkt);
if (ret < 0)
return ret;
av_packet_unref(avpkt);
*avpkt = tmp;
}
}
......
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