[PATCH 17/19] Removed resource leaks from mountd/cache.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mountd/cache.c:1244:3: warning: statement will never be
	executed [-Wswitch-unreachable]

mountd/cache.c:1260: leaked_storage: Variable "locations"
	going out of scope leaks the storage it points to.

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 utils/mountd/cache.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 2cb370f..bdbd190 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -1240,7 +1240,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
 		goto out;
 	}
 	status = nfs_get_basic_junction(pathname, &locations);
-	switch (status) {
+	if (status) {
 		xlog(L_WARNING, "Dangling junction %s: %s",
 			pathname, strerror(status));
 		goto out;
@@ -1248,10 +1248,11 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
 
 	parent = lookup_parent_export(dom, pathname, ai);
 	if (parent == NULL)
-		goto out;
+		goto free_locations;
 
 	exp = locations_to_export(locations, pathname, parent);
 
+free_locations:
 	nfs_free_locations(locations->ns_list);
 	free(locations);
 
-- 
2.20.1




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux