diff options
author | NRK <nrk@disroot.org> | 2023-06-29 03:26:45 +0600 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-07-02 12:47:31 +0200 |
commit | fa7503989fb931a8854428ce5984ab1095d56271 (patch) | |
tree | 7b63a5b820c5ecc61308e1c20d4428f7d720c913 /video | |
parent | f76c441ba2ec60d34f91341fb2643bcbccecf433 (diff) | |
download | mpv-fa7503989fb931a8854428ce5984ab1095d56271.tar.bz2 mpv-fa7503989fb931a8854428ce5984ab1095d56271.tar.xz |
vo_x11: check for calloc() failure
Diffstat (limited to 'video')
-rw-r--r-- | video/out/vo_x11.c | 8 |
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; } |