summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-09-21 07:40:36 +0200
committerMichael Adam <obnox@samba.org>2010-09-21 07:41:23 +0200
commitd86d2256b98e8975d536b85ba5221508642dea22 (patch)
tree01ccd85542aff25c2e014b252324be05ba2cfa65
parent919450a60ed996c35a1443a18d057031d56649c7 (diff)
downloadsamba-d86d2256b98e8975d536b85ba5221508642dea22.tar.gz
samba-d86d2256b98e8975d536b85ba5221508642dea22.tar.bz2
samba-d86d2256b98e8975d536b85ba5221508642dea22.zip
s3:services_db: convert get_common_service_dispname() to talloc
-rw-r--r--source3/services/services_db.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c
index 6d361c7464..7de613efc0 100644
--- a/source3/services/services_db.c
+++ b/source3/services/services_db.c
@@ -134,24 +134,25 @@ static struct security_descriptor* construct_service_sd( TALLOC_CTX *ctx )
Display name, Description, etc...
********************************************************************/
-static char *get_common_service_dispname( const char *servicename )
+static char *get_common_service_dispname(TALLOC_CTX *mem_ctx,
+ const char *servicename)
{
int i;
for ( i=0; common_unix_svcs[i].servicename; i++ ) {
if (strequal(servicename, common_unix_svcs[i].servicename)) {
char *dispname;
- if (asprintf(&dispname,
- "%s (%s)",
- common_unix_svcs[i].dispname,
- common_unix_svcs[i].servicename) < 0) {
+ dispname = talloc_asprintf(mem_ctx, "%s (%s)",
+ common_unix_svcs[i].dispname,
+ common_unix_svcs[i].servicename);
+ if (dispname == NULL) {
return NULL;
}
return dispname;
}
}
- return SMB_STRDUP(servicename );
+ return talloc_strdup(mem_ctx, servicename);
}
/********************************************************************
@@ -376,9 +377,8 @@ static void fill_service_values(struct registry_key *key)
name);
/* lookup common unix display names */
- dispname = get_common_service_dispname(name);
+ dispname = get_common_service_dispname(mem_ctx, name);
dname = talloc_strdup(mem_ctx, dispname ? dispname : "");
- SAFE_FREE(dispname);
/* get info from init file itself */
if ( read_init_file( name, &init_info ) ) {