txn_commit must abort txn before returning errors

Fix for failure when committing a txn that is a child of
some parent txn.
This commit is contained in:
Howard Chu 2012-01-21 08:20:43 -08:00
parent 1c8de1883c
commit 3d6b924c25
2 changed files with 4 additions and 1 deletions

View file

@ -1737,8 +1737,10 @@ mdb_txn_commit(MDB_txn *txn)
}
x = dst[0].mid;
for (; y<=src[0].mid; y++) {
if (++x >= MDB_IDL_UM_MAX)
if (++x >= MDB_IDL_UM_MAX) {
mdb_txn_abort(txn);
return ENOMEM;
}
dst[x] = src[y];
}
dst[0].mid = x;

View file

@ -530,6 +530,7 @@ int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **
* <li>EINVAL - an invalid parameter was specified.
* <li>ENOSPC - no more disk space.
* <li>EIO - a low-level I/O error occurred while writing.
* <li>ENOMEM - the transaction is nested and could not be merged into its parent.
* </ul>
*/
int mdb_txn_commit(MDB_txn *txn);