[PATCH v2 2/2] migration: Fix memory leak in postcopy_ram_listen_thread()

Arun Menon posted 2 patches 2 weeks, 3 days ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, Dmitry Osipenko <dmitry.osipenko@collabora.com>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Cornelia Huck <cohuck@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>
[PATCH v2 2/2] migration: Fix memory leak in postcopy_ram_listen_thread()
Posted by Arun Menon 2 weeks, 3 days ago
commit 94272d9b45 introduced a memory leak in the
postcopy_ram_listen_thread() call.
We need to free the local error object in the if clause as well.

Signed-off-by: Arun Menon <armenon@redhat.com>
---
 migration/savevm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/migration/savevm.c b/migration/savevm.c
index 7b35ec4dd007c6ed494201be8528a9e4f1c13843..f18c6ee659c1b9a005ff8ccfe51875f81d37694b 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2141,6 +2141,7 @@ static void *postcopy_ram_listen_thread(void *opaque)
                          "bitmaps may be lost, and present migrated dirty "
                          "bitmaps are correctly migrated and valid.",
                          __func__, load_res);
+            error_free(local_err);
             load_res = 0; /* prevent further exit() */
         } else {
             error_prepend(&local_err,

-- 
2.51.0