Replace another malloc/memset-0 combination with calloc
authorMatt Turner <mattst88@gmail.com>
Wed, 5 Sep 2012 06:12:46 +0000 (23:12 -0700)
committerMatt Turner <mattst88@gmail.com>
Thu, 6 Sep 2012 05:28:50 +0000 (22:28 -0700)
Reviewed-by: Brian Paul <brianp@vmware.com>
src/glx/indirect_glx.c

index f3cc1e7d049729854173449d07f08f134f4b9628..ff869e2dc8fed168ec45e7e9c0d05a40a1ab67b4 100644 (file)
@@ -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);
 
    /*