nfs-utils/6035-remove-resource-leaks-from-mountd-cache.c.patch
2019-09-30 11:09:50 -04:00

39 lines
1.1 KiB
Diff

From 74847efcc0899cd02c24aff5ba92c7859a7923ce Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 16:01:17 +0800
Subject: [PATCH] backport remove a resource leak from mountd/cache.c
---
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 7e8d403..a054ce6 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);
--
1.8.3.1