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
1 changed files with 6 additions and 1 deletions

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