[Spice-devel] [PATCH 1/2] fix valgrind warning in test_display__stream

Christophe Fergeau cfergeau at redhat.com
Tue Aug 2 03:31:56 PDT 2011


create_test_primary_surface::test_display_base.c creates a
QXLDevSurfaceCreate structure and initialize it, but doesn't set
the position field. Moreover, this structure has 4 bytes of padding
to the end (as shown by pahole from dwarves), so initialize the whole
structure to 0 before using it.
---
 server/tests/test_display_base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 76817d9..ff8650e 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -235,7 +235,7 @@ static uint8_t primary_surface[HEIGHT * WIDTH * 4];
 
 static void create_test_primary_surface(QXLWorker *worker)
 {
-    QXLDevSurfaceCreate surface;
+    QXLDevSurfaceCreate surface = { 0, };
 
     surface.format     = SPICE_SURFACE_FMT_32_xRGB;
     surface.width      = WIDTH;
-- 
1.7.6



More information about the Spice-devel mailing list