diff options
author | Michael Adam <obnox@samba.org> | 2010-09-20 04:12:42 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-09-21 06:53:30 +0200 |
commit | 4fc2b5c40e63579c2fe4e95bdbaa31108f2b3475 (patch) | |
tree | 50372a6f56225d4a741e52775b9a6330a4b5bf9e /source3/services | |
parent | 9bfd587358fb58b98dd0fbdd72069430a89cefc7 (diff) | |
download | samba-4fc2b5c40e63579c2fe4e95bdbaa31108f2b3475.tar.gz samba-4fc2b5c40e63579c2fe4e95bdbaa31108f2b3475.tar.bz2 samba-4fc2b5c40e63579c2fe4e95bdbaa31108f2b3475.zip |
s3:services_db: use temp talloc ctx in svcctl_get_secdesc()
Diffstat (limited to 'source3/services')
-rw-r--r-- | source3/services/services_db.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c index baac9d90d5..1ebaa77aa0 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -521,14 +521,17 @@ struct security_descriptor *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *nam char *path= NULL; WERROR wresult; NTSTATUS status; + TALLOC_CTX *mem_ctx = talloc_stackframe(); /* now add the security descriptor */ - if (asprintf(&path, "%s\\%s\\%s", KEY_SERVICES, name, "Security") < 0) { - return NULL; + path = talloc_asprintf(mem_ctx, "%s\\%s\\%s", KEY_SERVICES, name, + "Security"); + if (path == NULL) { + goto done; } - wresult = regkey_open_internal( NULL, &key, path, token, - REG_KEY_ALL ); + + wresult = regkey_open_internal(mem_ctx, &key, path, token, REG_KEY_ALL); if ( !W_ERROR_IS_OK(wresult) ) { DEBUG(0,("svcctl_get_secdesc: key lookup failed! [%s] (%s)\n", path, win_errstr(wresult))); @@ -565,8 +568,7 @@ fallback_to_default_sd: ret_sd = construct_service_sd(ctx); done: - SAFE_FREE(path); - TALLOC_FREE(key); + talloc_free(mem_ctx); return ret_sd; } |