mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-28 07:49:59 +00:00
Xext: vidmode: ProcVidModeGetMonitor(): move local buffers on stack
No need to go through global heap here, for such short-lived and small buffers. And stack variables are automatically cleaned up on leave. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt, metux IT consult .
parent
f8d240b56b
commit
fc37435fda
@@ -1200,7 +1200,6 @@ static int
|
||||
ProcVidModeGetMonitor(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXF86VidModeGetMonitorReq);
|
||||
CARD32 *hsyncdata, *vsyncdata;
|
||||
ScreenPtr pScreen;
|
||||
VidModePtr pVidMode;
|
||||
int i, nHsync, nVrefresh, vendorLength = 0, modelLength = 0;
|
||||
@@ -1244,16 +1243,8 @@ ProcVidModeGetMonitor(ClientPtr client)
|
||||
pad_to_int32(modelLength)),
|
||||
};
|
||||
|
||||
hsyncdata = xallocarray(nHsync, sizeof(CARD32));
|
||||
if (!hsyncdata) {
|
||||
return BadAlloc;
|
||||
}
|
||||
vsyncdata = xallocarray(nVrefresh, sizeof(CARD32));
|
||||
|
||||
if (!vsyncdata) {
|
||||
free(hsyncdata);
|
||||
return BadAlloc;
|
||||
}
|
||||
CARD32 hsyncdata[nHsync];
|
||||
CARD32 vsyncdata[nVrefresh];
|
||||
|
||||
for (i = 0; i < nHsync; i++) {
|
||||
hsyncdata[i] = (unsigned short) (pVidMode->GetMonitorValue(pScreen,
|
||||
@@ -1287,9 +1278,6 @@ ProcVidModeGetMonitor(ClientPtr client)
|
||||
WriteToClient(client, rep.modelLength,
|
||||
(pVidMode->GetMonitorValue(pScreen, VIDMODE_MON_MODEL, 0)).ptr);
|
||||
|
||||
free(hsyncdata);
|
||||
free(vsyncdata);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user