From 6aef9bbbf7160cf9e79c50e13632bf29efaedb65 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 6 May 2009 02:09:56 +0200 Subject: s3:loadparm: refactor freeing of file_list out into free_file_lists() Michael --- source3/param/loadparm.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) (limited to 'source3/param') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a6c535c182..ba7c212f7f 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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 */ -- cgit