]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10520 LMDB: cleanup on crypto errors and exits
authorHoward Chu <hyc@openldap.org>
Tue, 9 Jun 2026 23:17:59 +0000 (00:17 +0100)
committerHoward Chu <hyc@openldap.org>
Sat, 13 Jun 2026 22:45:08 +0000 (23:45 +0100)
libraries/liblmdb/mdb.c
libraries/liblmdb/mdb_dump.c

index 6e5a4a9797cf99c99d1fa7dbcf4a0dd31062aea8..6a435cc8016495e044b9e2116179b06e94d97a11 100644 (file)
@@ -6439,8 +6439,10 @@ mdb_env_close_active(MDB_env *env, int excl)
        if (env->me_rpages) {
                MDB_ID3L el = env->me_rpages;
                unsigned int x;
-               for (x=1; x<=el[0].mid; x++)
+               for (x=1; x<=el[0].mid; x++) {
                        munmap(el[x].mptr, el[x].mcnt * env->me_psize);
+                       free(el[x].menc);
+               }
                free(el);
        }
        }
@@ -7110,8 +7112,10 @@ retry:
                                        id3.mid = pg0;
                                        if (env->me_encfunc || env->me_sumfunc) {
                                                rc = mdb_rpage_encsum(env, &id3, rem, numpgs);
-                                               if (rc)
+                                               if (rc) {
+                                                       free(id3.menc);
                                                        goto fail;
+                                               }
                                                el[x].muse = id3.muse;
                                        }
                                        pthread_mutex_unlock(&env->me_rpmutex);
@@ -7178,8 +7182,10 @@ fail:
                }
                if (env->me_encfunc || env->me_sumfunc) {
                        rc = mdb_rpage_encsum(env, &id3, rem, numpgs);
-                       if (rc)
+                       if (rc) {
+                               free(id3.menc);
                                goto fail;
+                       }
                }
                mdb_mid3l_insert(el, &id3);
                pthread_mutex_unlock(&env->me_rpmutex);
index a31797f5d8112a5f9b8e50b4fc66e5bc7c997de6..5a6734ba60f938a74a585bedd6a03c42fa22d8e3 100644 (file)
@@ -154,6 +154,7 @@ static int dumpit(MDB_txn *txn, MDB_dbi dbi, char *name)
        printf("DATA=END\n");
        if (rc == MDB_NOTFOUND)
                rc = MDB_SUCCESS;
+       mdb_cursor_close(mc);
 
        return rc;
 }