aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Nazar <nazard@nazar.ca>2020-07-23 13:45:52 -0400
committerSteve Dickson <steved@redhat.com>2020-07-23 13:45:52 -0400
commit9bb4752e3141148995c110517472a298e80dfa44 (patch)
treeea3c866fa19079d0238a77c4b608e4700128e234
parenta5194cee26705e5239287b3c6a466b54ce38686c (diff)
downloadnfs-utils-9bb4752e3141148995c110517472a298e80dfa44.tar.gz
exportfs: Fix a few valgrind warnings
Signed-off-by: Doug Nazar <nazard@nazar.ca> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--support/nfs/exports.c1
-rw-r--r--utils/exportfs/exportfs.c7
2 files changed, 7 insertions, 1 deletions
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;
}