All of lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Mitchell <jumitche@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 1/7] nfs-utils: Fix minor memory leaks
Date: Mon, 23 Apr 2018 16:24:30 +0100	[thread overview]
Message-ID: <1524497070.7418.4.camel@redhat.com> (raw)
In-Reply-To: <1524496788.7418.2.camel@redhat.com>

Fix some minor memory leaks, a null pointer reference and a typo.

Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
 support/nfs/conffile.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 29f132d..a4cc236 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -186,7 +186,7 @@ conf_set_now(const char *section, const char *arg, const char *tag,
 		conf_remove_now(section, tag);
 	else if (conf_get_section(section, arg, tag)) {
 		if (!is_default) {
-			xlog(LOG_INFO, "conf_set: duplicate tag [%s]:%s, ignoring...\n", 
+			xlog(LOG_INFO, "conf_set: duplicate tag [%s]:%s, ignoring...", 
 				section, tag);
 		}
 		return 1;
@@ -659,7 +659,7 @@ retry:
 	for (; cb; cb = LIST_NEXT (cb, link)) {
 		if (strcasecmp(section, cb->section) != 0)
 			continue;
-		if (arg && strcasecmp(arg, cb->arg) != 0)
+		if (arg && (cb->arg == NULL || strcasecmp(arg, cb->arg) != 0))
 			continue;
 		if (strcasecmp(tag, cb->tag) != 0)
 			continue;
@@ -917,6 +917,8 @@ conf_set(int transaction, const char *section, const char *arg,
 fail:
 	if (node->tag)
 		free(node->tag);
+	if (node->arg)
+		free(node->arg);
 	if (node->section)
 		free(node->section);
 	if (node)
@@ -1004,6 +1006,8 @@ conf_end(int transaction, int commit)
 			TAILQ_REMOVE (&conf_trans_queue, node, link);
 			if (node->section)
 				free(node->section);
+			if (node->arg)
+				free(node->arg);
 			if (node->tag)
 				free(node->tag);
 			if (node->value)
-- 
1.8.3.1




  reply	other threads:[~2018-04-23 15:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23 15:19 [PATCH 0/7] nfs-utils: nfsconf cli tool and code tests Justin Mitchell
2018-04-23 15:24 ` Justin Mitchell [this message]
2018-04-23 15:25 ` [PATCH 2/7] nfs-utils: Make config includes relative to current config Justin Mitchell
2018-05-02 18:21   ` Steve Dickson
2018-05-03 10:11     ` Justin Mitchell
2018-04-23 15:26 ` [PATCH 3/7] nfs-utils: Use config file name in error messages Justin Mitchell
2018-04-23 15:26 ` [PATCH 4/7] nfs-utils: Indicate if config file was missing Justin Mitchell
2018-04-23 15:27 ` [PATCH 5/7] nfs-utils: tidy up output of conf_report Justin Mitchell
2018-05-02 18:24   ` Steve Dickson
2018-04-23 15:34 ` [PATCH 6/7] nfs-utils: Add nfsconftool cli Justin Mitchell
2018-05-02 18:25   ` Steve Dickson
2018-04-23 15:35 ` [PATCH 7/7] nfs-utils: use nfsconftool cli to test library function Justin Mitchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1524497070.7418.4.camel@redhat.com \
    --to=jumitche@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.