nostrdb

an unfairly fast embedded nostr database backed by lmdb
git clone git://jb55.com/nostrdb
Log | Files | Refs | Submodules | README | LICENSE

commit b28108066e0669a6b28bdf6cc050ca27eaed45f9
parent a8d6925a5b33ddbdd4306423527b5d8314f7dd36
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 11 Jul 2025 12:25:06 -0700

mem: reaction stats cleanup

Diffstat:
Msrc/nostrdb.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/nostrdb.c b/src/nostrdb.c @@ -3388,7 +3388,7 @@ static int ndb_write_reaction_stats(struct ndb_txn *txn, struct ndb_note *note) if (root == NULL) { ndb_debug("failed to create note metadata record\n"); - return 0; + goto fail; } // metadata is keyed on id because we want to collect stats regardless @@ -3406,13 +3406,18 @@ static int ndb_write_reaction_stats(struct ndb_txn *txn, struct ndb_note *note) if ((rc = mdb_put(txn->mdb_txn, txn->lmdb->dbs[NDB_DB_META], &key, &val, 0))) { ndb_debug("write reaction stats to db failed: %s\n", mdb_strerror(rc)); - free(root); - return 0; + goto fail; } free(root); + flatcc_builder_clear(&builder); return 1; + +fail: + free(root); + flatcc_builder_clear(&builder); + return 0; }