s3:loadparm: refactor freeing of file_list out into free_file_lists()
authorMichael Adam <obnox@samba.org>
Wed, 6 May 2009 00:09:56 +0000 (02:09 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 12 May 2009 06:41:00 +0000 (08:41 +0200)
Michael

source3/param/loadparm.c

index a6c535c..ba7c212 100644 (file)
@@ -6976,6 +6976,26 @@ static void add_to_file_list(const char *fname, const char *subfname)
        }
 }
 
+/**
+ * Free the file lists
+ */
+static void free_file_list(void)
+{
+       struct file_lists *f;
+       struct file_lists *next;
+
+       f = file_lists;
+       while( f ) {
+               next = f->next;
+               SAFE_FREE( f->name );
+               SAFE_FREE( f->subfname );
+               SAFE_FREE( f );
+               f = next;
+       }
+       file_lists = NULL;
+}
+
+
 /**
  * Utility function for outsiders to check if we're running on registry.
  */
@@ -8962,21 +8982,9 @@ int load_usershare_shares(void)
 
 void gfree_loadparm(void)
 {
-       struct file_lists *f;
-       struct file_lists *next;
        int i;
 
-       /* Free the file lists */
-
-       f = file_lists;
-       while( f ) {
-               next = f->next;
-               SAFE_FREE( f->name );
-               SAFE_FREE( f->subfname );
-               SAFE_FREE( f );
-               f = next;
-       }
-       file_lists = NULL;
+       free_file_list();
 
        /* Free resources allocated to services */