diff options
author | Scott Mayhew <smayhew@redhat.com> | 2015-02-26 14:23:53 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2015-02-26 14:34:00 -0500 |
commit | 484be028e408901bc54e76859c17713a2d5a2252 (patch) | |
tree | 3e2fedb01db4c1688f61890f52cc574049e402ed /support | |
parent | 810423415dd1a2b7275b3abf294e6a69951614a1 (diff) | |
download | nfs-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.c | 2 |
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) |