diff --git a/Xi/getdctl.c b/Xi/getdctl.c index 88462b767..e4f4a855b 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -153,7 +153,6 @@ int ProcXGetDeviceControl(ClientPtr client) { int rc, total_length = 0; - char *savbuf; DeviceIntPtr dev; REQUEST(xGetDeviceControlReq); @@ -186,7 +185,7 @@ ProcXGetDeviceControl(ClientPtr client) char *buf = calloc(1, total_length); if (!buf) return BadAlloc; - savbuf = buf; + char *savbuf = buf; switch (stuff->control) { case DEVICE_RESOLUTION: diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 64dab777a..bf3db9864 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -244,7 +244,6 @@ int ProcXGetFeedbackControl(ClientPtr client) { int rc, total_length = 0; - char *savbuf; DeviceIntPtr dev; KbdFeedbackPtr k; PtrFeedbackPtr p; @@ -298,7 +297,7 @@ ProcXGetFeedbackControl(ClientPtr client) char *buf = (char *) calloc(1, total_length); if (!buf) return BadAlloc; - savbuf = buf; + char *savbuf = buf; for (k = dev->kbdfeed; k; k = k->next) CopySwapKbdFeedback(client, k, &buf); @@ -322,6 +321,5 @@ ProcXGetFeedbackControl(ClientPtr client) } WriteToClient(client, sizeof(xGetFeedbackControlReply), &rep); WriteToClient(client, total_length, savbuf); - free(savbuf); return Success; } diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index 3e3ccdc58..6bd117414 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -342,7 +342,6 @@ ProcXIGetSelectedEvents(ClientPtr client) { int rc, i; WindowPtr win; - char *buffer = NULL; OtherInputMasks *masks; InputClientsPtr others = NULL; xXIEventMask *evmask = NULL; @@ -374,10 +373,8 @@ ProcXIGetSelectedEvents(ClientPtr client) if (!others) goto finish; - buffer = - calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE)); - if (!buffer) - return BadAlloc; + char buffer[MAXDEVICES * (sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE))]; + memset(buffer, 0, sizeof(buffer)); evmask = (xXIEventMask *) buffer; for (i = 0; i < MAXDEVICES; i++) { @@ -423,6 +420,5 @@ finish: ; WriteToClient(client, sizeof(xXIGetSelectedEventsReply), &rep); WriteToClient(client, length * 4, buffer); - free(buffer); return Success; }