0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

vo_x11: don't rely on XFree to free calloc-ed data

This commit is contained in:
NRK 2023-06-29 04:07:08 +06:00 committed by sfan5
parent fa7503989f
commit b616a6cef1

View File

@ -153,8 +153,13 @@ static void freeMyXImage(struct priv *p, int foo)
XDestroyImage(p->myximage[foo]);
shmdt(p->Shminfo[foo].shmaddr);
} else {
if (p->myximage[foo])
if (p->myximage[foo]) {
// XDestroyImage() would free the data too since XFree() just calls
// free(), but do it ourselves for portability reasons
free(p->myximage[foo]->data);
p->myximage[foo]->data = NULL;
XDestroyImage(p->myximage[foo]);
}
}
p->myximage[foo] = NULL;
}