Commit 712ee858 authored by James Almer's avatar James Almer

avcodec/encode: free non-referenced packets' side data in the old encode API functions

Fixes memleaks introduced by a22c6a47.
parent b591329c
...@@ -227,6 +227,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, ...@@ -227,6 +227,7 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
ret = av_packet_ref(&tmp, avpkt); ret = av_packet_ref(&tmp, avpkt);
if (ret < 0) if (ret < 0)
return ret; return ret;
av_packet_unref(avpkt);
*avpkt = tmp; *avpkt = tmp;
} }
} }
...@@ -325,6 +326,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, ...@@ -325,6 +326,7 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
ret = av_packet_ref(&tmp, avpkt); ret = av_packet_ref(&tmp, avpkt);
if (ret < 0) if (ret < 0)
return ret; return ret;
av_packet_unref(avpkt);
*avpkt = tmp; *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