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
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;