properly zero newly allocated memobj and vregion.
authorSimon Gerber <simon.gerber@hp.com>
Wed, 18 Jun 2014 21:46:39 +0000 (14:46 -0700)
committerSimon Gerber <simon.gerber@inf.ethz.ch>
Thu, 30 Apr 2015 19:19:28 +0000 (21:19 +0200)
Signed-off-by: Simon Gerber <simon.gerber@hp.com>

lib/barrelfish/vspace/utils.c

index 7bfcf98..bb9c82a 100644 (file)
@@ -347,12 +347,12 @@ errval_t vspace_map_one_frame_attr_aligned(void **retaddr, size_t size,
     size = ROUND_UP(size, BASE_PAGE_SIZE);
 
     // Allocate space
-    memobj = malloc(sizeof(struct memobj_one_frame));
+    memobj = calloc(1, sizeof(struct memobj_one_frame));
     if (!memobj) {
         err1 = LIB_ERR_MALLOC_FAIL;
         goto error;
     }
-    vregion = malloc(sizeof(struct vregion));
+    vregion = calloc(1, sizeof(struct vregion));
     if (!vregion) {
         err1 = LIB_ERR_MALLOC_FAIL;
         goto error;