From 1be8f5fba4d5059a43732e2ad65ab269132bd205 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 May 2010 14:03:46 +0200 Subject: s3:services_db: use regval_ctr_init() instead of direct allocation --- source3/services/services_db.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'source3/services/services_db.c') diff --git a/source3/services/services_db.c b/source3/services/services_db.c index ba5b6a91e1..aa99ac9fef 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -376,7 +376,8 @@ static void add_new_svc_name(struct registry_key_handle *key_parent, /* now for the service values */ - if ( !(values = TALLOC_ZERO_P( key_service, struct regval_ctr )) ) { + wresult = regval_ctr_init(key_service, &values); + if (!W_ERROR_IS_OK(wresult)) { DEBUG(0,("add_new_svc_name: talloc() failed!\n")); TALLOC_FREE( key_service ); return; @@ -405,7 +406,8 @@ static void add_new_svc_name(struct registry_key_handle *key_parent, } SAFE_FREE(path); - if ( !(values = TALLOC_ZERO_P( key_secdesc, struct regval_ctr )) ) { + wresult = regval_ctr_init(key_secdesc, &values); + if (!W_ERROR_IS_OK(wresult)) { DEBUG(0,("add_new_svc_name: talloc() failed!\n")); TALLOC_FREE( key_secdesc ); return; @@ -522,7 +524,8 @@ struct security_descriptor *svcctl_get_secdesc( TALLOC_CTX *ctx, const char *nam goto done; } - if ( !(values = TALLOC_ZERO_P( key, struct regval_ctr )) ) { + wresult = regval_ctr_init(key, &values); + if (!W_ERROR_IS_OK(wresult)) { DEBUG(0,("svcctl_get_secdesc: talloc() failed!\n")); goto done; } @@ -585,7 +588,8 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, struct security_desc } SAFE_FREE(path); - if ( !(values = TALLOC_ZERO_P( key, struct regval_ctr )) ) { + wresult = regval_ctr_init(key, &values); + if (!W_ERROR_IS_OK(wresult)) { DEBUG(0,("svcctl_set_secdesc: talloc() failed!\n")); TALLOC_FREE( key ); return False; @@ -638,7 +642,8 @@ const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TO } SAFE_FREE(path); - if ( !(values = TALLOC_ZERO_P( key, struct regval_ctr )) ) { + wresult = regval_ctr_init(key, &values); + if (!W_ERROR_IS_OK(wresult)) { DEBUG(0,("svcctl_lookup_dispname: talloc() failed!\n")); TALLOC_FREE( key ); goto fail; @@ -690,7 +695,8 @@ const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER } SAFE_FREE(path); - if ( !(values = TALLOC_ZERO_P( key, struct regval_ctr )) ) { + wresult = regval_ctr_init(key, &values); + if (!W_ERROR_IS_OK(wresult)) { DEBUG(0,("svcctl_lookup_description: talloc() failed!\n")); TALLOC_FREE( key ); return NULL; @@ -737,7 +743,8 @@ struct regval_ctr *svcctl_fetch_regvalues(const char *name, NT_USER_TOKEN *token } SAFE_FREE(path); - if ( !(values = TALLOC_ZERO_P( NULL, struct regval_ctr )) ) { + wresult = regval_ctr_init(NULL, &values); + if (!W_ERROR_IS_OK(wresult)) { DEBUG(0,("svcctl_fetch_regvalues: talloc() failed!\n")); TALLOC_FREE( key ); return NULL; -- cgit