From edb8484c2c90072e8e85e23a87c59fa768e924df Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 10 Jul 2024 18:41:17 +0200 Subject: [PATCH] (submit/cleanup-xv-dispatch) Xext: xv: use alloca() for small buffer in ProcXvQueryImageAttributes() The buffer should be small enough for easily fitting on stack, so let's use that and never again worrying about forgotten free()'s :) Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/xvdisp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 57b040b41e..075d1782d0 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -995,7 +995,7 @@ ProcXvQueryImageAttributes(ClientPtr client) // allocating for `offsets` as well as `pitches` in one block // both having CARD32 * num_planes (actually int32_t put into CARD32) - if (!(offsets = malloc(num_planes * sizeof(CARD32) * 2))) + if (!(offsets = alloca(num_planes * sizeof(CARD32) * 2))) return BadAlloc; pitches = offsets + num_planes; @@ -1021,8 +1021,6 @@ ProcXvQueryImageAttributes(ClientPtr client) SwapLongs((CARD32 *) offsets, rep.length); WriteToClient(client, rep.length * sizeof(CARD32), offsets); - free(offsets); - return Success; }