From: Michael Adam Date: Sat, 12 Apr 2008 23:42:46 +0000 (+0200) Subject: registry cachehook: fix memleak (to talloc_tos()): free key at the end. X-Git-Tag: samba-3.3.0pre1~2716 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f5955d361da5278773b46dccb34c8f63eb04157;p=thirdparty%2Fsamba.git registry cachehook: fix memleak (to talloc_tos()): free key at the end. Michael --- diff --git a/source/registry/reg_cachehook.c b/source/registry/reg_cachehook.c index bb190411eed..705d08abf88 100644 --- a/source/registry/reg_cachehook.c +++ b/source/registry/reg_cachehook.c @@ -69,6 +69,7 @@ bool reghook_cache_init( void ) bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops) { + bool ret; char *key = NULL; key = keyname_to_path(talloc_tos(), keyname); @@ -80,7 +81,9 @@ bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops) DEBUG(10, ("reghook_cache_add: Adding ops %p for key [%s]\n", (void *)ops, key)); - return pathtree_add(cache_tree, key, ops); + ret = pathtree_add(cache_tree, key, ops); + TALLOC_FREE(key); + return ret; } /**********************************************************************