From fa7503989fb931a8854428ce5984ab1095d56271 Mon Sep 17 00:00:00 2001 From: NRK Date: Thu, 29 Jun 2023 03:26:45 +0600 Subject: vo_x11: check for calloc() failure --- video/out/vo_x11.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'video') diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index be0ee85963..42b7c7f5da 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -133,12 +133,14 @@ shmemerror: p->myximage[foo] = XCreateImage(vo->x11->display, p->vinfo.visual, p->depth, ZPixmap, 0, NULL, p->image_width, p->image_height, 8, 0); - if (!p->myximage[foo]) { + if (p->myximage[foo]) { + p->myximage[foo]->data = + calloc(1, p->myximage[foo]->bytes_per_line * p->image_height + 32); + } + if (!p->myximage[foo] || !p->myximage[foo]->data) { MP_WARN(vo, "could not allocate image"); return false; } - p->myximage[foo]->data = - calloc(1, p->myximage[foo]->bytes_per_line * p->image_height + 32); } return true; } -- cgit v1.2.3