summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-11-29 16:45:15 +0100
committerMichael Adam <obnox@samba.org>2012-11-29 20:21:50 +0100
commit2f38a77a2dfc72ccd94f5027807c9484dae54358 (patch)
treea42717e410185f2f1d4ce068d62a2b32218277d6 /source3
parente271db4fd82d03b39a5872b1a3fde5e2a16e1633 (diff)
downloadsamba-2f38a77a2dfc72ccd94f5027807c9484dae54358.tar.gz
samba-2f38a77a2dfc72ccd94f5027807c9484dae54358.tar.bz2
samba-2f38a77a2dfc72ccd94f5027807c9484dae54358.zip
dbwrap: Do not rely on dbwrap_record_get_value to return a talloc object
db_tdb_fetch_locked returns the value as part of a larger talloc object that also contains the key. This means we can not realloc, but have to freshly alloc. Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Thu Nov 29 20:21:51 CET 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/dbwrap/dbwrap_watch.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c
index 701ac9d02f..d7392a3235 100644
--- a/source3/lib/dbwrap/dbwrap_watch.c
+++ b/source3/lib/dbwrap/dbwrap_watch.c
@@ -119,12 +119,13 @@ static NTSTATUS dbwrap_record_add_watcher(TDB_DATA w_key, struct server_id id)
ids = (struct server_id *)value.dptr;
num_ids = value.dsize / sizeof(struct server_id);
- ids = talloc_realloc(talloc_tos(), ids, struct server_id,
- num_ids + 1);
+ ids = talloc_array(talloc_tos(), struct server_id,
+ num_ids + 1);
if (ids == NULL) {
status = NT_STATUS_NO_MEMORY;
goto fail;
}
+ memcpy(ids, value.dptr, value.dsize);
ids[num_ids] = id;
num_ids += 1;