summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-01-11 13:47:08 +0100
committerStefan Metzmacher <metze@samba.org>2012-01-11 16:13:50 +0100
commitd7dcbcc42d9a8424ec2204a220b3b912b7be2f70 (patch)
tree77849930b5610584838e3587e8dff729b091932d
parent97818fd6e552f6ddc30f5b9728d6e82121150867 (diff)
downloadsamba-d7dcbcc42d9a8424ec2204a220b3b912b7be2f70.tar.gz
samba-d7dcbcc42d9a8424ec2204a220b3b912b7be2f70.tar.bz2
samba-d7dcbcc42d9a8424ec2204a220b3b912b7be2f70.zip
lib/param: avoid talloc_reference() in copy_service()
The memory reduction compared of talloc_reference() over talloc_strdup() is typically very low. As the strings are typically short compared to the talloc header overhead. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Wed Jan 11 16:13:50 CET 2012 on sn-devel-104
-rw-r--r--lib/param/loadparm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index 949c404bf1..03ee8f34ac 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2140,7 +2140,7 @@ static void copy_service(struct loadparm_service *pserviceDest,
/* If we already have same option, override it */
if (strcmp(pdata->key, data->key) == 0) {
talloc_free(pdata->value);
- pdata->value = talloc_reference(pdata,
+ pdata->value = talloc_strdup(pdata,
data->value);
not_added = false;
break;
@@ -2151,8 +2151,8 @@ static void copy_service(struct loadparm_service *pserviceDest,
paramo = talloc_zero(pserviceDest, struct parmlist_entry);
if (paramo == NULL)
smb_panic("OOM");
- paramo->key = talloc_reference(paramo, data->key);
- paramo->value = talloc_reference(paramo, data->value);
+ paramo->key = talloc_strdup(paramo, data->key);
+ paramo->value = talloc_strdup(paramo, data->value);
DLIST_ADD(pserviceDest->param_opt, paramo);
}
data = data->next;