From 4235aab8974ef4e72e2b7ccdc7d8dee3750d3333 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 8 Nov 2014 16:10:04 +0100 Subject: mp_image: check memory allocation --- video/mp_image.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/video/mp_image.c b/video/mp_image.c index 860a47ea6f..1ba7a4ee2c 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -689,6 +689,10 @@ struct AVFrame *mp_image_to_av_frame_and_unref(struct mp_image *img) if (!new_ref) return NULL; AVFrame *frame = av_frame_alloc(); + if (!frame) { + talloc_free(new_ref); + return NULL; + } mp_image_copy_fields_to_av_frame(frame, new_ref); // Caveat: if img has shared references, and all other references disappear // at a later point, the AVFrame will still be read-only. -- cgit v1.2.3