diff options
author | Volker Lendecke <vl@samba.org> | 2008-06-17 16:06:42 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2008-06-17 16:09:22 +0200 |
commit | 04e697891bc5857acd4f28c10678204febae710e (patch) | |
tree | d5828d19f10185d53413b1578839d135b8a3536d /source3 | |
parent | 6f66dbcda681a374ceacce45567de9249d87864a (diff) | |
download | samba-04e697891bc5857acd4f28c10678204febae710e.tar.gz samba-04e697891bc5857acd4f28c10678204febae710e.tar.bz2 samba-04e697891bc5857acd4f28c10678204febae710e.zip |
Fix a memleak in svcctl_init_keys()
(This used to be commit 675bb53398ba29c53d2dcf3c7122cf4770c2f938)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/services/services_db.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c index 620b036932..ae9fe1aeb7 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -447,15 +447,22 @@ void svcctl_init_keys( void ) REGSUBKEY_CTR *subkeys; REGISTRY_KEY *key = NULL; WERROR wresult; + struct nt_user_token *token = get_root_nt_token(); + + if (token == NULL) { + DEBUG(0, ("svcctl_init_keys: get_root_nt_token failed\n")); + return; + } /* bad mojo here if the lookup failed. Should not happen */ wresult = regkey_open_internal( NULL, &key, KEY_SERVICES, - get_root_nt_token(), REG_KEY_ALL ); + token, REG_KEY_ALL ); if ( !W_ERROR_IS_OK(wresult) ) { DEBUG(0,("svcctl_init_keys: key lookup failed! (%s)\n", dos_errstr(wresult))); + TALLOC_FREE(token); return; } @@ -464,6 +471,7 @@ void svcctl_init_keys( void ) if ( !(subkeys = TALLOC_ZERO_P( key, REGSUBKEY_CTR )) ) { DEBUG(0,("svcctl_init_keys: talloc() failed!\n")); TALLOC_FREE( key ); + TALLOC_FREE(token); return; } @@ -486,6 +494,7 @@ void svcctl_init_keys( void ) } TALLOC_FREE( key ); + TALLOC_FREE(token); /* initialize the control hooks */ |