[Spice-devel] [PATCH 1/4] replay: remove some memory leaks

Frediano Ziglio fziglio at redhat.com
Mon Aug 24 06:20:27 PDT 2015


Free primary surface memory after creation.
Free command line options.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red_replay_qxl.c | 1 +
 server/tests/replay.c   | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/server/red_replay_qxl.c b/server/red_replay_qxl.c
index a010a58..ca1d584 100644
--- a/server/red_replay_qxl.c
+++ b/server/red_replay_qxl.c
@@ -1074,6 +1074,7 @@ static void replay_handle_create_primary(QXLWorker *worker, SpiceReplay *replay)
     surface.group_id = 0;
     surface.mem = (QXLPHYSICAL)mem;
     worker->create_primary_surface(worker, 0, &surface);
+    free(mem);
 }
 
 static void replay_handle_dev_input(QXLWorker *worker, SpiceReplay *replay,
diff --git a/server/tests/replay.c b/server/tests/replay.c
index 01590c0..c35cb52 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -286,12 +286,16 @@ int main(int argc, char **argv)
         g_printerr("%s\n", g_option_context_get_help(context, TRUE, NULL));
         exit(1);
     }
+    g_option_context_free(context);
+    context = NULL;
 
     if (strncmp(file[0], "-", 1) == 0) {
         fd = stdin;
     } else {
         fd = fopen(file[0], "r");
     }
+    g_strfreev(file);
+    file = NULL;
     if (fd == NULL) {
         g_printerr("error opening %s\n", argv[1]);
         return 1;
@@ -325,6 +329,8 @@ int main(int argc, char **argv)
     if (client) {
         start_client(client, &error);
         wait = TRUE;
+        g_free(client);
+        client = NULL;
     }
 
     if (!wait) {
-- 
2.4.3



More information about the Spice-devel mailing list