mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
avviddec: Fix memory leaks and assertions in error cases if we can't allocate a frame
This commit is contained in:
parent
f5c112990f
commit
47647e1cac
1 changed files with 7 additions and 2 deletions
|
@ -482,7 +482,7 @@ static int
|
||||||
gst_ffmpegviddec_get_buffer (AVCodecContext * context, AVFrame * picture)
|
gst_ffmpegviddec_get_buffer (AVCodecContext * context, AVFrame * picture)
|
||||||
{
|
{
|
||||||
GstVideoCodecFrame *frame;
|
GstVideoCodecFrame *frame;
|
||||||
GstFFMpegVidDecVideoFrame *dframe;
|
GstFFMpegVidDecVideoFrame *dframe = NULL;
|
||||||
GstFFMpegVidDec *ffmpegdec;
|
GstFFMpegVidDec *ffmpegdec;
|
||||||
gint c;
|
gint c;
|
||||||
GstVideoInfo *info;
|
GstVideoInfo *info;
|
||||||
|
@ -580,6 +580,10 @@ invalid_frame:
|
||||||
}
|
}
|
||||||
fallback:
|
fallback:
|
||||||
{
|
{
|
||||||
|
if (dframe)
|
||||||
|
gst_ffmpegviddec_video_frame_free (dframe);
|
||||||
|
picture->opaque = NULL;
|
||||||
|
|
||||||
return avcodec_default_get_buffer (context, picture);
|
return avcodec_default_get_buffer (context, picture);
|
||||||
}
|
}
|
||||||
duplicate_frame:
|
duplicate_frame:
|
||||||
|
@ -666,7 +670,8 @@ gst_ffmpegviddec_release_buffer (AVCodecContext * context, AVFrame * picture)
|
||||||
/* we remove the opaque data now */
|
/* we remove the opaque data now */
|
||||||
picture->opaque = NULL;
|
picture->opaque = NULL;
|
||||||
|
|
||||||
gst_ffmpegviddec_video_frame_free (frame);
|
if (frame)
|
||||||
|
gst_ffmpegviddec_video_frame_free (frame);
|
||||||
|
|
||||||
/* zero out the reference in ffmpeg */
|
/* zero out the reference in ffmpeg */
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
|
|
Loading…
Reference in a new issue