vo_x11: check for calloc() failure

This commit is contained in:
NRK 2023-06-29 03:26:45 +06:00 committed by sfan5
parent f76c441ba2
commit fa7503989f
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}