[Spice-commits] server/tests

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Jan 19 06:04:41 PST 2016


 server/tests/test-qxl-parsing.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 28c35857307e94874f3968745bf0797a3408c73c
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Mon Jan 18 14:32:30 2016 +0000

    tests: remove leaks in test-qxl-parsing
    
    This make happy address sanitizer during make check.
    Otherwise memory leak detector can keep in and make tests fails.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/server/tests/test-qxl-parsing.c b/server/tests/test-qxl-parsing.c
index d44289f..a3b2e6c 100644
--- a/server/tests/test-qxl-parsing.c
+++ b/server/tests/test-qxl-parsing.c
@@ -65,6 +65,8 @@ int main(int argc, char **argv)
     QXLCursor *cursor;
     QXLDataChunk *chunks[2];
 
+    void *surface_mem;
+
     memset(&qxl, 0, sizeof(qxl));
 
     qxl.surface_id = 123;
@@ -75,7 +77,8 @@ int main(int argc, char **argv)
     qxl.u.surface_create.width = 128;
     qxl.u.surface_create.stride = 512;
     qxl.u.surface_create.height = 128;
-    qxl.u.surface_create.data = to_physical(malloc(0x10000));
+    surface_mem = malloc(0x10000);
+    qxl.u.surface_create.data = to_physical(surface_mem);
     if (red_get_surface_cmd(&mem_info, 0, &cmd, to_physical(&qxl)))
         failure();
 
@@ -117,6 +120,7 @@ int main(int argc, char **argv)
 
     if (red_get_cursor_cmd(&mem_info, 0, &red_cursor_cmd, to_physical(&cursor_cmd)))
         failure();
+    free(red_cursor_cmd.u.set.shape.data);
     free(cursor);
 
     /* a circular list of empty chunks should not be a problems */
@@ -173,5 +177,9 @@ int main(int argc, char **argv)
     free(cursor);
     free(chunks[0]);
 
+    free(mem_info.mem_slots[0]);
+    free(mem_info.mem_slots);
+    free(surface_mem);
+
     return exit_code;
 }


More information about the Spice-commits mailing list