diff mbox

[4/4] fedfsd: Fix memory leak in fedfsd_svc_get_limited_nsdb_params_1()

Message ID 20130108173053.65331.6625.stgit@seurat.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Jan. 8, 2013, 5:30 p.m. UTC
If the requested NSDB is not in the server's NSDB database, the
buffer containing the NSDB's hostname is leaked.

Introduced by commit 0520ee72 "Initial commit" Tue Mar 29 15:37:40
2011.

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

 src/fedfsd/svc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/src/fedfsd/svc.c b/src/fedfsd/svc.c
index 93b110b..9132177 100644
--- a/src/fedfsd/svc.c
+++ b/src/fedfsd/svc.c
@@ -1111,9 +1111,7 @@  fedfsd_svc_get_limited_nsdb_params_1(SVCXPRT *xprt)
 		xlog(L_WARNING, "Unrecognized NSDB connection security "
 			"type for %s:%u", hostname, port);
 	}
-
 	nsdb_free_nsdb(host);
-	free(hostname);
 
 out:
 	xlog(D_CALL, "%s: Replying with %s",
@@ -1126,6 +1124,8 @@  out:
 
 	if (!svc_freeargs(xprt, (xdrproc_t)xdr_FedFsNsdbName, (caddr_t)&args))
 		xlog(L_WARNING, "Failed to free GET_LIMITED_NSDB_PARAMS arguments");
+
+	free(hostname);
 }
 
 /**