export: Ensure that we free struct exportent->e_uuid
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 13 Oct 2010 15:27:21 +0000 (11:27 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 14 Oct 2010 14:26:58 +0000 (10:26 -0400)
Currently, the exportent->e_uuid is initialised in
support/nfs/exports.c:parseopts(), but it is never freed.

Also ensure that exportent->e_uuid is duplicated correctly in
dupexportent().

Adjusted to account for the new export_free() helper.

Also, e_uuid points to memory that is always allocated with strdup(3),
not with xstrdup().  Thus it must be freed via free(3) and not via
xfree().

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
support/export/export.c
support/nfs/exports.c

index f528603..4fda30a 100644 (file)
@@ -38,6 +38,7 @@ export_free(nfs_export *exp)
        xfree(exp->m_export.e_sqgids);
        free(exp->m_export.e_mountpoint);
        free(exp->m_export.e_fslocdata);
+       free(exp->m_export.e_uuid);
 
        xfree(exp->m_export.e_hostname);
        xfree(exp);
index a93941c..1744ed6 100644 (file)
@@ -332,6 +332,8 @@ dupexportent(struct exportent *dst, struct exportent *src)
                dst->e_mountpoint = strdup(src->e_mountpoint);
        if (src->e_fslocdata)
                dst->e_fslocdata = strdup(src->e_fslocdata);
+       if (src->e_uuid)
+               dst->e_uuid = strdup(src->e_uuid);
        dst->e_hostname = NULL;
 }