diff options
Diffstat (limited to 'source3/registry/reg_cachehook.c')
-rw-r--r-- | source3/registry/reg_cachehook.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index 739facac99..289d4e50ce 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -47,18 +47,24 @@ bool reghook_cache_init( void ) bool reghook_cache_add( REGISTRY_HOOK *hook ) { - pstring key; - - if ( !hook ) - return False; - - pstrcpy( key, "\\"); - pstrcat( key, hook->keyname ); - - pstring_sub( key, "\\", "/" ); + TALLOC_CTX *ctx = talloc_tos(); + char *key = NULL; + + if (!hook) { + return false; + } + + key = talloc_asprintf(ctx, "//%s", hook->keyname); + if (!key) { + return false; + } + key = talloc_string_sub(ctx, key, "\\", "/"); + if (!key) { + return false; + } DEBUG(10,("reghook_cache_add: Adding key [%s]\n", key)); - + return pathtree_add( cache_tree, key, hook ); } |