summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorScott Mayhew <smayhew@redhat.com>2015-02-26 14:23:53 -0500
committerSteve Dickson <steved@redhat.com>2015-02-26 14:34:00 -0500
commit484be028e408901bc54e76859c17713a2d5a2252 (patch)
tree3e2fedb01db4c1688f61890f52cc574049e402ed /support
parent810423415dd1a2b7275b3abf294e6a69951614a1 (diff)
downloadnfs-utils-484be028e408901bc54e76859c17713a2d5a2252.tar.gz
nfs-utils-484be028e408901bc54e76859c17713a2d5a2252.tar.xz
nfs-utils-484be028e408901bc54e76859c17713a2d5a2252.zip
mountd: Fix memory leak in getexportent
Valgrind shows that the memory allocated for ee.e_hostname in getexportent() is being leaked. While there _is_ a call to xfree(), by the time it gets called the leak's already happened. Moving the xfree() call so that it occurs before the assignment that overwrites ee fixes this. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support')
-rw-r--r--support/nfs/exports.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index eb782b9..4b17d3c 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -154,6 +154,7 @@ getexportent(int fromkernel, int fromexports)
}
}
+ xfree(ee.e_hostname);
ee = def_ee;
/* Check for default client */
@@ -176,7 +177,6 @@ getexportent(int fromkernel, int fromexports)
if (!has_default_opts)
xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp);
}
- xfree(ee.e_hostname);
ee.e_hostname = xstrdup(hostname);
if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)