diff options
author | Volker Lendecke <vl@samba.org> | 2018-03-04 11:51:13 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2018-03-22 07:21:44 +0100 |
commit | 7964b3640aacaab68f002c290d82f86e7c709268 (patch) | |
tree | f52dfd69cfec80fa46e3bdf5b354b129ef9bbfe2 /lib/tdb/common | |
parent | 2adbb1f75183a1105848ccb6acc577541279b3f6 (diff) | |
download | samba-7964b3640aacaab68f002c290d82f86e7c709268.tar.gz |
tdb: Fix a "increases alignment" warning
Many of those warnings are difficult to fix, but this one was easy :-)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 22 07:21:44 CET 2018 on sn-devel-144
Diffstat (limited to 'lib/tdb/common')
-rw-r--r-- | lib/tdb/common/transaction.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index 390e51dfa2a..73d02b684a3 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -854,13 +854,12 @@ static int transaction_setup_recovery(struct tdb_context *tdb, return -1; } - data = (unsigned char *)malloc(recovery_size + sizeof(*rec)); - if (data == NULL) { + rec = malloc(recovery_size + sizeof(*rec)); + if (rec == NULL) { tdb->ecode = TDB_ERR_OOM; return -1; } - rec = (struct tdb_record *)data; memset(rec, 0, sizeof(*rec)); rec->magic = TDB_RECOVERY_INVALID_MAGIC; @@ -869,6 +868,8 @@ static int transaction_setup_recovery(struct tdb_context *tdb, rec->key_len = old_map_size; CONVERT(*rec); + data = (unsigned char *)rec; + /* build the recovery data into a single blob to allow us to do a single large write, which should be more efficient */ p = data + sizeof(*rec); |