[Spice-devel] [PATCH xf86-video-qxl 03/11] xspice: zero memory on allocation, fix uninitialized use (valgrind reported)

Alon Levy alevy at redhat.com
Mon Sep 2 08:02:44 PDT 2013


Signed-off-by: Alon Levy <alevy at redhat.com>
---
 src/qxl_driver.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 731a71a..d5ad45f 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -177,13 +177,13 @@ unmap_memory_helper (qxl_screen_t *qxl)
 static void
 map_memory_helper (qxl_screen_t *qxl)
 {
-    qxl->ram = malloc (RAM_SIZE);
+    qxl->ram = calloc (RAM_SIZE, 1);
     qxl->ram_size = RAM_SIZE;
     qxl->ram_physical = qxl->ram;
-    qxl->vram = malloc (VRAM_SIZE);
+    qxl->vram = calloc (VRAM_SIZE, 1);
     qxl->vram_size = VRAM_SIZE;
     qxl->vram_physical = qxl->vram;
-    qxl->rom = malloc (ROM_SIZE);
+    qxl->rom = calloc (ROM_SIZE, 1);
     
     init_qxl_rom (qxl, ROM_SIZE);
 }
-- 
1.8.3.1



More information about the Spice-devel mailing list