]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mountd: Add mountlist_freeall()
authorChuck Lever <chuck.lever@oracle.com>
Thu, 16 Sep 2010 17:48:38 +0000 (13:48 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 16 Sep 2010 18:33:51 +0000 (14:33 -0400)
I'm about to add a second bit of logic that needs to free all
mountlist records, so introduce a helper for freeing them.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mountd/rmtab.c

index b2c04e769750d289a4fd8b2a929596e7e49ee0e5..854d519808dd23f7861b4623b3407ae6b55a99bd 100644 (file)
@@ -173,6 +173,18 @@ out_unlock:
        xfunlock(lockid);
 }
 
+static void
+mountlist_freeall(mountlist list)
+{
+       while (list != NULL) {
+               mountlist m = list;
+               list = m->ml_next;
+               xfree(m->ml_hostname);
+               xfree(m->ml_directory);
+               xfree(m);
+       }
+}
+
 mountlist
 mountlist_list(void)
 {
@@ -194,12 +206,7 @@ mountlist_list(void)
                return NULL;
        }
        if (stb.st_mtime != last_mtime) {
-               while (mlist) {
-                       mlist = (m = mlist)->ml_next;
-                       xfree(m->ml_hostname);
-                       xfree(m->ml_directory);
-                       xfree(m);
-               }
+               mountlist_freeall(mlist);
                last_mtime = stb.st_mtime;
 
                setrmtabent("r");