All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Nazar <nazard@nazar.ca>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 1/4] exportfs: Fix a few valgrind warnings
Date: Wed, 22 Jul 2020 01:53:51 -0400	[thread overview]
Message-ID: <20200722055354.28132-2-nazard@nazar.ca> (raw)
In-Reply-To: <20200722055354.28132-1-nazard@nazar.ca>

Signed-off-by: Doug Nazar <nazard@nazar.ca>
---
 support/nfs/exports.c     | 1 +
 utils/exportfs/exportfs.c | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index 97eb3183..037febd0 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -838,6 +838,7 @@ struct export_features *get_export_features(void)
 	close(fd);
 	if (c == -1)
 		goto err;
+	buf[c] = 0;
 	c = sscanf(buf, "%x %x", &ef.flags, &ef.secinfo_flags);
 	if (c != 2)
 		goto err;
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index a04a7898..cde5e517 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -85,8 +85,11 @@ grab_lockfile()
 static void
 release_lockfile()
 {
-	if (_lockfd != -1)
+	if (_lockfd != -1) {
 		lockf(_lockfd, F_ULOCK, 0);
+		close(_lockfd);
+		_lockfd = -1;
+	}
 }
 
 int
@@ -184,6 +187,7 @@ main(int argc, char **argv)
 			xtab_export_read();
 			dump(f_verbose, f_export_format);
 			free_state_path_names(&etab);
+			export_freeall();
 			return 0;
 		}
 	}
@@ -225,6 +229,7 @@ main(int argc, char **argv)
 	xtab_export_write();
 	cache_flush(force_flush);
 	free_state_path_names(&etab);
+	export_freeall();
 
 	return export_errno;
 }
-- 
2.26.2


  reply	other threads:[~2020-07-22  5:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  5:53 [PATCH 0/4] nfs-utils patches Doug Nazar
2020-07-22  5:53 ` Doug Nazar [this message]
2020-07-22  5:53 ` [PATCH 2/4] idmapd: Add graceful exit and resource cleanup Doug Nazar
2020-07-23 17:56   ` Steve Dickson
2020-07-23 18:25     ` Doug Nazar
2020-07-23 19:16       ` Steve Dickson
2020-07-22  5:53 ` [PATCH 3/4] idmapd: Fix client mode support Doug Nazar
2020-07-22  5:53 ` [PATCH 4/4] nfsidmap: Allow overriding location of method libraries Doug Nazar
2020-07-27 14:42 ` [PATCH 0/4] nfs-utils patches Steve Dickson

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=20200722055354.28132-2-nazard@nazar.ca \
    --to=nazard@nazar.ca \
    --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.