2019-05-08 13:47:45

by Steve Dickson

[permalink] [raw]
Subject: [PATCH 07/19] Removed resource leaks from nfs/xlog.c

nfs/xlog.c:139: leaked_storage: Variable "kinds" going out
of scope leaks the storage it points to.

nfs/xlog.c:142: leaked_storage: Variable "kinds" going out
of scope leaks the storage it points to.

Signed-off-by: Steve Dickson <[email protected]>
---
support/nfs/xlog.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c
index f75a9ab..687d862 100644
--- a/support/nfs/xlog.c
+++ b/support/nfs/xlog.c
@@ -135,10 +135,14 @@ xlog_from_conffile(char *service)
struct conf_list_node *n;

kinds = conf_get_list(service, "debug");
- if (!kinds || !kinds->cnt)
+ if (!kinds || !kinds->cnt) {
+ free(kinds);
return;
+ }
TAILQ_FOREACH(n, &(kinds->fields), link)
xlog_sconfig(n->field, 1);
+
+ conf_free_list(kinds);
}

int
--
2.20.1