Partial backport of ddb8d8945d1f44d16 for valgrind cleanliness

This commit is contained in:
Lauri Kasanen 2015-05-27 15:54:39 +03:00
parent ed9ebc423a
commit 4402a80630
8 changed files with 18 additions and 2 deletions

View File

@ -88,6 +88,7 @@ ClientPtr client;
return BadRequest; return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq); REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE; client->big_requests = TRUE;
memset(&rep, 0, sizeof(xBigReqEnableReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;

View File

@ -303,6 +303,7 @@ ClientPtr client;
xShapeQueryVersionReply rep; xShapeQueryVersionReply rep;
REQUEST_SIZE_MATCH(xShapeQueryVersionReq); REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;

View File

@ -324,6 +324,7 @@ ClientPtr client;
REQUEST_SIZE_MATCH(xShmQueryVersionReq); REQUEST_SIZE_MATCH(xShmQueryVersionReq);
memset(&rep, 0, sizeof(xShmQueryVersionReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;

View File

@ -1319,6 +1319,7 @@ ClientPtr client;
REQUEST_SIZE_MATCH(xSyncInitializeReq); REQUEST_SIZE_MATCH(xSyncInitializeReq);
memset(&rep, 0, sizeof(xSyncInitializeReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.majorVersion = SYNC_MAJOR_VERSION; rep.majorVersion = SYNC_MAJOR_VERSION;

View File

@ -807,6 +807,7 @@ ProcGetModifierMapping(ClientPtr client)
KeyClassPtr keyc = inputInfo.keyboard->key; KeyClassPtr keyc = inputInfo.keyboard->key;
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
memset(&rep, 0, sizeof(xGetModifierMappingReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.numKeyPerModifier = keyc->maxKeysPerModifier; rep.numKeyPerModifier = keyc->maxKeysPerModifier;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
@ -920,6 +921,7 @@ ProcGetKeyboardMapping(ClientPtr client)
return BadValue; return BadValue;
} }
memset(&rep, 0, sizeof(xGetKeyboardMappingReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.keySymsPerKeyCode = curKeySyms->mapWidth; rep.keySymsPerKeyCode = curKeySyms->mapWidth;

View File

@ -555,6 +555,7 @@ ProcGetWindowAttributes(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pWin) if (!pWin)
return (BadWindow); return (BadWindow);
memset(&wa, 0, sizeof(xGetWindowAttributesReply));
GetWindowAttributes(pWin, client, &wa); GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
return (client->noClientException); return (client->noClientException);
@ -817,6 +818,7 @@ ProcGetGeometry(register ClientPtr client)
int status; int status;
memset(&rep, 0, sizeof(xGetGeometryReply));
if ((status = GetGeometry(client, &rep)) != Success) if ((status = GetGeometry(client, &rep)) != Success)
return status; return status;
@ -842,6 +844,7 @@ ProcQueryTree(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pWin) if (!pWin)
return (BadWindow); return (BadWindow);
memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
@ -896,6 +899,7 @@ ProcInternAtom(register ClientPtr client)
if (atom != BAD_RESOURCE) { if (atom != BAD_RESOURCE) {
xInternAtomReply reply = {0}; xInternAtomReply reply = {0};
memset(&reply, 0, sizeof(xInternAtomReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = 0; reply.length = 0;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
@ -921,6 +925,7 @@ ProcGetAtomName(register ClientPtr client)
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
if ((str = NameForAtom(stuff->id))) { if ((str = NameForAtom(stuff->id))) {
len = strlen(str); len = strlen(str);
memset(&reply, 0, sizeof(xGetAtomNameReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = (len + 3) >> 2; reply.length = (len + 3) >> 2;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
@ -1194,6 +1199,7 @@ ProcTranslateCoords(register ClientPtr client)
SecurityReadAccess); SecurityReadAccess);
if (!pDst) if (!pDst)
return (BadWindow); return (BadWindow);
memset(&rep, 0, sizeof(xTranslateCoordsReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
@ -1332,7 +1338,7 @@ ProcQueryFont(register ClientPtr client)
rlength = sizeof(xQueryFontReply) + rlength = sizeof(xQueryFontReply) +
FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) +
nprotoxcistructs * sizeof(xCharInfo); nprotoxcistructs * sizeof(xCharInfo);
reply = (xQueryFontReply *) ALLOCATE_LOCAL(rlength); reply = (xQueryFontReply *) calloc(1, rlength);
if (!reply) { if (!reply) {
return (BadAlloc); return (BadAlloc);
} }
@ -1343,7 +1349,7 @@ ProcQueryFont(register ClientPtr client)
QueryFont(pFont, reply, nprotoxcistructs); QueryFont(pFont, reply, nprotoxcistructs);
WriteReplyToClient(client, rlength, reply); WriteReplyToClient(client, rlength, reply);
DEALLOCATE_LOCAL(reply); free(reply);
return (client->noClientException); return (client->noClientException);
} }
} }
@ -2104,6 +2110,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
return (BadValue); return (BadValue);
} }
SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess); SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, SecurityReadAccess);
memset(&xgi, 0, sizeof(xGetImageReply));
if (pDraw->type == DRAWABLE_WINDOW) { if (pDraw->type == DRAWABLE_WINDOW) {
if ( /* check for being viewable */ if ( /* check for being viewable */
!((WindowPtr) pDraw)->realized || !((WindowPtr) pDraw)->realized ||

View File

@ -782,6 +782,7 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
for (i = 0; i < nnames; i++) for (i = 0; i < nnames; i++)
stringLens += (names->length[i] <= 255) ? names->length[i] : 0; stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
memset(&reply, 0, sizeof(xListFontsReply));
reply.type = X_Reply; reply.type = X_Reply;
reply.length = (stringLens + nnames + 3) >> 2; reply.length = (stringLens + nnames + 3) >> 2;
reply.nFonts = nnames; reply.nFonts = nnames;
@ -1028,6 +1029,7 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
err = AllocError; err = AllocError;
goto bail; goto bail;
} }
memset(reply + c->length, 0, length - c->length);
c->reply = reply; c->reply = reply;
c->length = length; c->length = length;
} }

View File

@ -2879,6 +2879,7 @@ ProcQueryPointer(ClientPtr client)
return BadWindow; return BadWindow;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
memset(&rep, 0, sizeof(xQueryPointerReply));
rep.type = X_Reply; rep.type = X_Reply;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
rep.mask = mouse->button->state | inputInfo.keyboard->key->state; rep.mask = mouse->button->state | inputInfo.keyboard->key->state;