mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +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,6 +670,7 @@ 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;
|
||||||
|
|
||||||
|
if (frame)
|
||||||
gst_ffmpegviddec_video_frame_free (frame);
|
gst_ffmpegviddec_video_frame_free (frame);
|
||||||
|
|
||||||
/* zero out the reference in ffmpeg */
|
/* zero out the reference in ffmpeg */
|
||||||
|
|
Loading…
Reference in a new issue