From: Hallvard Furuseth Date: Fri, 9 Mar 2012 18:22:31 +0000 (+0100) Subject: Fix valgrind call after malloc failure in mdb. X-Git-Tag: OPENLDAP_REL_ENG_2_4_32~125^2~33 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5c182fbedf5f69d167073c2a2b4766798a247928;p=openldap Fix valgrind call after malloc failure in mdb. Also line up the code logic a bit. --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 6abadd2fbe..4e3d70dc13 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -1126,13 +1126,11 @@ static MDB_page * mdb_page_malloc(MDB_cursor *mc) { MDB_page *ret; size_t sz = mc->mc_txn->mt_env->me_psize; - if (mc->mc_txn->mt_env->me_dpages) { - ret = mc->mc_txn->mt_env->me_dpages; + if ((ret = mc->mc_txn->mt_env->me_dpages) != NULL) { VGMEMP_ALLOC(mc->mc_txn->mt_env, ret, sz); VGMEMP_DEFINED(ret, sizeof(ret->mp_next)); mc->mc_txn->mt_env->me_dpages = ret->mp_next; - } else { - ret = malloc(sz); + } else if ((ret = malloc(sz)) != NULL) { VGMEMP_ALLOC(mc->mc_txn->mt_env, ret, sz); } return ret;