diff options
author | Gerald Carter <jerry@samba.org> | 2006-04-08 17:25:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:15:55 -0500 |
commit | bbf666e447132a5f6b206ddf9ca918298b756392 (patch) | |
tree | 3cac70deddd159edbd7fb3aece639c48e9a5e67e /source3/param | |
parent | c9c502442b40aba97de17456ba948effcdfa3d05 (diff) | |
download | samba-bbf666e447132a5f6b206ddf9ca918298b756392.tar.gz samba-bbf666e447132a5f6b206ddf9ca918298b756392.tar.bz2 samba-bbf666e447132a5f6b206ddf9ca918298b756392.zip |
r15003: patch based on code from Arkady Glabek <aglabek@centeris.com> to ensure that global memory is freed when unloading pam_winbind.so (needs more testing on non-linux platforms)
(This used to be commit 1e0b79e591d70352a96e0a0487d8f394dc7b36ba)
Diffstat (limited to 'source3/param')
-rw-r--r-- | source3/param/loadparm.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index b7d6546fd9..e0c6c0686f 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -4865,6 +4865,56 @@ int load_usershare_shares(void) return lp_numservices(); } +/******************************************************** + Destroy global resources allocated in this file +********************************************************/ + +void gfree_loadparm(void) +{ + struct file_lists *f; + struct file_lists *next; + int i; + + lp_TALLOC_FREE(); + + /* 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; + } + + /* Free resources allocated to services */ + + for ( i = 0; i < iNumServices; i++ ) { + if ( VALID(i) ) { + free_service_byindex(i); + } + } + + SAFE_FREE( ServicePtrs ); + iNumServices = 0; + + /* Now release all resources allocated to global + parameters and the default service */ + + for (i = 0; parm_table[i].label; i++) + { + if ( parm_table[i].type == P_STRING + || parm_table[i].type == P_USTRING ) + { + string_free( (char**)parm_table[i].ptr ); + } + else if (parm_table[i].type == P_LIST) { + str_list_free( (char***)parm_table[i].ptr ); + } + } +} + /*************************************************************************** Load the services array from the services file. Return True on success, False on failure. |