summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
Diffstat (limited to 'video/out')
-rw-r--r--video/out/vo_x11.c8
1 files changed, 5 insertions, 3 deletions
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;
}