mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-05 06:53:57 +00:00
(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 <info@metux.net>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user