diff options
author | NRK <nrk@disroot.org> | 2023-06-29 04:07:08 +0600 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-07-02 12:47:31 +0200 |
commit | b616a6cef17dd77b485c1ae20be8732038535c82 (patch) | |
tree | 5c346a2f2fa466162accb9e875edf27a459f1212 /video | |
parent | fa7503989fb931a8854428ce5984ab1095d56271 (diff) | |
download | mpv-b616a6cef17dd77b485c1ae20be8732038535c82.tar.bz2 mpv-b616a6cef17dd77b485c1ae20be8732038535c82.tar.xz |
vo_x11: don't rely on XFree to free calloc-ed data
Diffstat (limited to 'video')
-rw-r--r-- | video/out/vo_x11.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index 42b7c7f5da..3579a3034b 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -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; } |