Patchwork [10/15] fedfsc: Free resources allocated by the XDR decoded results

login
register
mail settings
Submitter Chuck Lever
Date Oct. 25, 2011, 4:49 p.m.
Message ID <20111025164946.18584.65496.stgit@seurat.1015granger.net>
Download mbox | patch
Permalink /patch/121753/
State Accepted
Headers show

Comments

Chuck Lever - Oct. 25, 2011, 4:49 p.m.
This is not strictly necessary, since these are one-shot clients that
exit quickly.  But it does clean up the output of valgrind so it's
easier to spot real leaks.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 src/fedfsc/fedfs-get-limited-nsdb-params.c |    6 +++++-
 src/fedfsc/fedfs-get-nsdb-params.c         |    6 +++++-
 src/fedfsc/fedfs-lookup-junction.c         |    6 +++++-
 src/fedfsc/fedfs-lookup-replication.c      |    6 +++++-
 4 files changed, 20 insertions(+), 4 deletions(-)

Patch

diff --git a/src/fedfsc/fedfs-get-limited-nsdb-params.c b/src/fedfsc/fedfs-get-limited-nsdb-params.c
index 937f369..5524635 100644
--- a/src/fedfsc/fedfs-get-limited-nsdb-params.c
+++ b/src/fedfsc/fedfs-get-limited-nsdb-params.c
@@ -138,8 +138,12 @@  fedfs_get_limited_nsdb_params_call(const char *hostname, const char *nettype,
 	if (status != RPC_SUCCESS) {
 		clnt_perror(client, "FEDFS_GET_LIMITED_NSDB_PARAMS call failed");
 		result.status = FEDFS_ERR_SVRFAULT;
-	} else
+	} else {
 		fedfs_get_limited_nsdb_params_print_result(result);
+		clnt_freeres(client,
+			(xdrproc_t)xdr_FedFsGetLimitedNsdbParamsRes,
+			(caddr_t)&result);
+	}
 	(void)clnt_destroy(client);
 
 out:
diff --git a/src/fedfsc/fedfs-get-nsdb-params.c b/src/fedfsc/fedfs-get-nsdb-params.c
index 9f718f2..d2c58d3 100644
--- a/src/fedfsc/fedfs-get-nsdb-params.c
+++ b/src/fedfsc/fedfs-get-nsdb-params.c
@@ -140,8 +140,12 @@  fedfs_get_nsdb_params_call(const char *hostname, const char *nettype,
 	if (status != RPC_SUCCESS) {
 		clnt_perror(client, "FEDFS_GET_NSDB_PARAMS call failed");
 		result.status = FEDFS_ERR_SVRFAULT;
-	} else
+	} else {
 		fedfs_get_nsdb_params_print_result(result);
+		clnt_freeres(client,
+			(xdrproc_t)xdr_FedFsGetNsdbParamsRes,
+			(caddr_t)&result);
+	}
 	(void)clnt_destroy(client);
 
 out:
diff --git a/src/fedfsc/fedfs-lookup-junction.c b/src/fedfsc/fedfs-lookup-junction.c
index 5ce33cc..365ff43 100644
--- a/src/fedfsc/fedfs-lookup-junction.c
+++ b/src/fedfsc/fedfs-lookup-junction.c
@@ -247,8 +247,12 @@  fedfs_lookup_junction_call(const char *hostname, const char *nettype,
 	if (status != RPC_SUCCESS) {
 		clnt_perror(client, "FEDFS_LOOKUP_JUNCTION call failed");
 		result.status = FEDFS_ERR_SVRFAULT;
-	} else
+	} else {
 		fedfs_lookup_junction_print_result(result);
+		clnt_freeres(client,
+			(xdrproc_t)xdr_FedFsLookupRes,
+			(caddr_t)&result);
+	}
 	(void)clnt_destroy(client);
 
 out:
diff --git a/src/fedfsc/fedfs-lookup-replication.c b/src/fedfsc/fedfs-lookup-replication.c
index d33c45d..2de129b 100644
--- a/src/fedfsc/fedfs-lookup-replication.c
+++ b/src/fedfsc/fedfs-lookup-replication.c
@@ -252,8 +252,12 @@  fedfs_lookup_replication_call(const char *hostname, const char *nettype,
 	if (status != RPC_SUCCESS) {
 		clnt_perror(client, "FEDFS_LOOKUP_REPLICATION call failed");
 		result.status = FEDFS_ERR_SVRFAULT;
-	} else
+	} else {
 		fedfs_lookup_replication_print_result(result);
+		clnt_freeres(client,
+			(xdrproc_t)xdr_FedFsLookupRes,
+			(caddr_t)&result);
+	}
 	(void)clnt_destroy(client);
 
 out: