glx: convert a malloc+memset to calloc
authorAdam Jackson <ajax@redhat.com>
Wed, 14 Aug 2019 16:04:42 +0000 (12:04 -0400)
committerAdam Jackson <ajax@redhat.com>
Tue, 20 Aug 2019 18:04:59 +0000 (14:04 -0400)
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/glx/glxconfig.c

index 555ccf8e62b6c2bfa1452543cf79dd197c58863b..87a02fa9b6bc8f75be9bd58388a349cc40330c27 100644 (file)
@@ -225,14 +225,13 @@ glx_config_create_list(unsigned count)
 
    next = &base;
    for (i = 0; i < count; i++) {
 
    next = &base;
    for (i = 0; i < count; i++) {
-      *next = malloc(size);
+      *next = calloc(1, size);
       if (*next == NULL) {
         glx_config_destroy_list(base);
         base = NULL;
         break;
       }
 
       if (*next == NULL) {
         glx_config_destroy_list(base);
         base = NULL;
         break;
       }
 
-      (void) memset(*next, 0, size);
       (*next)->visualID = GLX_DONT_CARE;
       (*next)->visualType = GLX_DONT_CARE;
       (*next)->visualRating = GLX_NONE;
       (*next)->visualID = GLX_DONT_CARE;
       (*next)->visualType = GLX_DONT_CARE;
       (*next)->visualRating = GLX_NONE;