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)
|
||||
{
|
||||
GstVideoCodecFrame *frame;
|
||||
GstFFMpegVidDecVideoFrame *dframe;
|
||||
GstFFMpegVidDecVideoFrame *dframe = NULL;
|
||||
GstFFMpegVidDec *ffmpegdec;
|
||||
gint c;
|
||||
GstVideoInfo *info;
|
||||
|
@ -580,6 +580,10 @@ invalid_frame:
|
|||
}
|
||||
fallback:
|
||||
{
|
||||
if (dframe)
|
||||
gst_ffmpegviddec_video_frame_free (dframe);
|
||||
picture->opaque = NULL;
|
||||
|
||||
return avcodec_default_get_buffer (context, picture);
|
||||
}
|
||||
duplicate_frame:
|
||||
|
@ -666,7 +670,8 @@ gst_ffmpegviddec_release_buffer (AVCodecContext * context, AVFrame * picture)
|
|||
/* we remove the opaque data now */
|
||||
picture->opaque = NULL;
|
||||
|
||||
gst_ffmpegviddec_video_frame_free (frame);
|
||||
if (frame)
|
||||
gst_ffmpegviddec_video_frame_free (frame);
|
||||
|
||||
/* zero out the reference in ffmpeg */
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
|
Loading…
Reference in a new issue