Mesa (master): Replace another malloc/memset-0 combination with calloc
Matt Turner
mattst88 at kemper.freedesktop.org
Thu Sep 6 05:29:05 UTC 2012
Module: Mesa
Branch: master
Commit: da3282b6e2f374b88daf09f7f3ba5b05af45f51a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=da3282b6e2f374b88daf09f7f3ba5b05af45f51a
Author: Matt Turner <mattst88 at gmail.com>
Date: Tue Sep 4 23:12:46 2012 -0700
Replace another malloc/memset-0 combination with calloc
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/glx/indirect_glx.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index f3cc1e7..ff869e2 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -361,14 +361,13 @@ indirect_create_context(struct glx_screen *psc,
glx_context_init(gc, psc, mode);
gc->isDirect = GL_FALSE;
gc->vtable = &indirect_context_vtable;
- state = malloc(sizeof(struct __GLXattributeRec));
+ state = calloc(1, sizeof(struct __GLXattributeRec));
if (state == NULL) {
/* Out of memory */
free(gc);
return NULL;
}
gc->client_state_private = state;
- memset(gc->client_state_private, 0, sizeof(struct __GLXattributeRec));
state->NoDrawArraysProtocol = (getenv("LIBGL_NO_DRAWARRAYS") != NULL);
/*
More information about the mesa-commit
mailing list