summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2023-06-29 04:07:08 +0600
committersfan5 <sfan5@live.de>2023-07-02 12:47:31 +0200
commitb616a6cef17dd77b485c1ae20be8732038535c82 (patch)
tree5c346a2f2fa466162accb9e875edf27a459f1212 /video
parentfa7503989fb931a8854428ce5984ab1095d56271 (diff)
downloadmpv-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.c7
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;
}