[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-1017-g25f571f

Michael Adam obnox at samba.org
Thu Jan 3 11:07:51 GMT 2008


The branch, v3-2-test has been updated
       via  25f571f40a630bff5a47bba6b01e42d4e0ffed66 (commit)
      from  3fc3fee88afd9e8b6232afc140a07090b4215c23 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 25f571f40a630bff5a47bba6b01e42d4e0ffed66
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jan 3 12:07:02 2008 +0100

    Return existsing cache_tree if it has already been initialized.
    
    So reghook_cache_init() does not leak memory when called more
    than once.
    Also, fix the return value while we are at it.
    
    Michael

-----------------------------------------------------------------------

Summary of changes:
 source/registry/reg_cachehook.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/registry/reg_cachehook.c b/source/registry/reg_cachehook.c
index 289d4e5..74670aa 100644
--- a/source/registry/reg_cachehook.c
+++ b/source/registry/reg_cachehook.c
@@ -25,19 +25,21 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
-static SORTED_TREE *cache_tree;
+static SORTED_TREE *cache_tree = NULL;
 extern REGISTRY_OPS regdb_ops;		/* these are the default */
 static REGISTRY_HOOK default_hook = { KEY_TREE_ROOT, &regdb_ops };
 
 /**********************************************************************
- Initialize the cache tree
+ Initialize the cache tree if it has not been initialized yet.
  *********************************************************************/
 
 bool reghook_cache_init( void )
 {
-	cache_tree = pathtree_init( &default_hook, NULL );
+	if (cache_tree == NULL) {
+		cache_tree = pathtree_init(&default_hook, NULL);
+	}
 
-	return ( cache_tree == NULL );
+	return (cache_tree != NULL);
 }
 
 /**********************************************************************


-- 
Samba Shared Repository


More information about the samba-cvs mailing list