From: Markus Armbruster Date: Thu, 28 Sep 2023 13:19:56 +0000 (+0200) Subject: migration/rdma: Plug a memory leak and improve a message X-Git-Tag: v8.2.0~126^2~28 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=e518b0050d41adf764aa06373acf0fbd696b8a0e;p=mirror_qemu.git migration/rdma: Plug a memory leak and improve a message When migration capability @rdma-pin-all is true, but the server cannot honor it, qemu_rdma_connect() calls macro ERROR(), then returns success. ERROR() sets an error. Since qemu_rdma_connect() returns success, its caller rdma_start_outgoing_migration() duly assumes @errp is still clear. The Error object leaks. ERROR() additionally reports the situation to the user as an error: RDMA ERROR: Server cannot support pinning all memory. Will register memory dynamically. Is this an error or not? It actually isn't; we disable @rdma-pin-all and carry on. "Correcting" the user's configuration decisions that way feels problematic, but that's a topic for another day. Replace ERROR() by warn_report(). This plugs the memory leak, and emits a clearer message to the user. Signed-off-by: Markus Armbruster Reviewed-by: Li Zhijian Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela Message-ID: <20230928132019.2544702-31-armbru@redhat.com> --- diff --git a/migration/rdma.c b/migration/rdma.c index b0125b01cf..00e3c430f4 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2637,8 +2637,8 @@ static int qemu_rdma_connect(RDMAContext *rdma, bool return_path, * and disable them otherwise. */ if (rdma->pin_all && !(cap.flags & RDMA_CAPABILITY_PIN_ALL)) { - ERROR(errp, "Server cannot support pinning all memory. " - "Will register memory dynamically."); + warn_report("RDMA: Server cannot support pinning all memory. " + "Will register memory dynamically."); rdma->pin_all = false; }