diff mbox

[34/37] tests: pc-cpu-test

Message ID 20160719085432.4572-35-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc-André Lureau July 19, 2016, 8:54 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

---
 tests/pc-cpu-test.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tests/pc-cpu-test.c b/tests/pc-cpu-test.c
index 4428cea..06afca3 100644
--- a/tests/pc-cpu-test.c
+++ b/tests/pc-cpu-test.c
@@ -78,7 +78,8 @@  static void add_pc_test_cases(void)
     const QListEntry *p;
     QObject *qobj;
     QString *qstr;
-    const char *mname, *path;
+    const char *mname;
+    char *path;
     PCTestData *data;
 
     qtest_start("-machine none");
@@ -99,7 +100,7 @@  static void add_pc_test_cases(void)
             continue;
         }
         data = g_malloc(sizeof(PCTestData));
-        data->machine = mname;
+        data->machine = g_strdup(mname);
         data->cpu_model = "Haswell"; /* 1.3+ theoretically */
         data->sockets = 1;
         data->cores = 3;
@@ -120,13 +121,16 @@  static void add_pc_test_cases(void)
                                    mname, data->sockets, data->cores,
                                    data->threads, data->maxcpus);
             qtest_add_data_func(path, data, test_pc_without_cpu_add);
+            g_free(path);
         } else {
             path = g_strdup_printf("cpu/%s/add/%ux%ux%u&maxcpus=%u",
                                    mname, data->sockets, data->cores,
                                    data->threads, data->maxcpus);
             qtest_add_data_func(path, data, test_pc_with_cpu_add);
+            g_free(path);
         }
     }
+    QDECREF(response);
     qtest_end();
 }