diff --git a/glx/single2.c b/glx/single2.c index 18fd2c1bc..2848f73c5 100644 --- a/glx/single2.c +++ b/glx/single2.c @@ -272,15 +272,15 @@ __glXcombine_strings(const char *cext_string, const char *sext_string) clen = strlen(cext_string); slen = strlen(sext_string); if (clen > slen) { - combo_string = (char *) malloc(slen + 2); - s1 = (char *) malloc(slen + 2); + combo_string = (char *) calloc(1, slen + 2); + s1 = (char *) calloc(1, slen + 2); if (s1) strcpy(s1, sext_string); s2 = cext_string; } else { - combo_string = (char *) malloc(clen + 2); - s1 = (char *) malloc(clen + 2); + combo_string = (char *) calloc(1, clen + 2); + s1 = (char *) calloc(1, clen + 2); if (s1) strcpy(s1, cext_string); s2 = sext_string; diff --git a/glx/vndcmds.c b/glx/vndcmds.c index 4ffa5f19f..3f9587a88 100644 --- a/glx/vndcmds.c +++ b/glx/vndcmds.c @@ -126,7 +126,6 @@ static int dispatch_GLXQueryVersion(ClientPtr client) static int dispatch_GLXClientInfo(ClientPtr client) { GlxServerVendor *vendor; - void *requestCopy = NULL; size_t requestSize = client->req_len * 4; if (client->minorOp == X_GLXClientInfo) { @@ -142,7 +141,7 @@ static int dispatch_GLXClientInfo(ClientPtr client) // We'll forward this request to each vendor library. Since a vendor might // modify the request data in place (e.g., for byte swapping), make a copy // of the request first. - requestCopy = malloc(requestSize); + void *requestCopy = calloc(1, requestSize); if (requestCopy == NULL) { return BadAlloc; } diff --git a/glx/xfont.c b/glx/xfont.c index 3e84369e8..05927f76c 100644 --- a/glx/xfont.c +++ b/glx/xfont.c @@ -64,7 +64,7 @@ __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) widthPadded = GLYPHWIDTHBYTESPADDED(pci); /* - ** Use the local buf if possible, otherwise malloc. + ** Use the local buf if possible, otherwise calloc. */ allocBytes = widthPadded * h; if (allocBytes <= __GL_CHAR_BUF_SIZE) { @@ -72,7 +72,7 @@ __glXMakeBitmapFromGlyph(FontPtr font, CharInfoPtr pci) allocbuf = 0; } else { - p = (unsigned char *) malloc(allocBytes); + p = calloc(1, allocBytes); if (!p) return BadAlloc; allocbuf = p;