From 62aa72c215e40df6b3d1db3fc439ae4934e914d5 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sun, 15 Dec 2024 10:00:30 -0800 Subject: [PATCH] nostrdb: leak: fix memory leak when failing to write like stats Signed-off-by: William Casarin --- nostrdb/src/nostrdb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nostrdb/src/nostrdb.c b/nostrdb/src/nostrdb.c index 429e7745..deeae806 100644 --- a/nostrdb/src/nostrdb.c +++ b/nostrdb/src/nostrdb.c @@ -2835,6 +2835,7 @@ 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; }