From 90b8168fd93490f3a0fadadb38030163712a0e85 Mon Sep 17 00:00:00 2001
From: wangmeiyang <wangmeiyang@xfusion.com>
Date: Fri, 21 Apr 2023 14:43:45 +0800
Subject: [PATCH] admin: fix leak of typed parameters on error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

A few admin client methods had the xdr_free call the wrong
side of the cleanup label, so typed parameters would not
be freed on error.

origin commit: https://gitlab.com/libvirt/libvirt/-/commit/0edf44664e9f2f75c7ba5faab91e2e190b5626af
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Meiyang Wang <wangmeiyang@xfusion.com>
---
 src/admin/admin_remote.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c
index ca5e0c9fe4..2499fb8b0f 100644
--- a/src/admin/admin_remote.c
+++ b/src/admin/admin_remote.c
@@ -271,9 +271,9 @@ remoteAdminServerGetThreadPoolParameters(virAdmServerPtr srv,
         goto cleanup;
 
     rv = 0;
-    xdr_free((xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret);
 
  cleanup:
+    xdr_free((xdrproc_t)xdr_admin_server_get_threadpool_parameters_ret, (char *) &ret);
     virObjectUnlock(priv);
     return rv;
 }
@@ -344,9 +344,9 @@ remoteAdminClientGetInfo(virAdmClientPtr client,
         goto cleanup;
 
     rv = 0;
-    xdr_free((xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret);
 
  cleanup:
+    xdr_free((xdrproc_t)xdr_admin_client_get_info_ret, (char *) &ret);
     virObjectUnlock(priv);
     return rv;
 }
@@ -382,10 +382,10 @@ remoteAdminServerGetClientLimits(virAdmServerPtr srv,
         goto cleanup;
 
     rv = 0;
-    xdr_free((xdrproc_t) xdr_admin_server_get_client_limits_ret,
-             (char *) &ret);
 
  cleanup:
+    xdr_free((xdrproc_t) xdr_admin_server_get_client_limits_ret,
+             (char *) &ret);
     virObjectUnlock(priv);
     return rv;
 }
-- 
2.27.0

