From cb3c0b48caeefafc2b8437d53ddb21716c520c8d Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Mon, 17 May 2021 08:10:51 +0200 Subject: [PATCH] Don't call hbm_delete_db() if not running in persistent mode. --- src/modules/history_backend_mem.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/modules/history_backend_mem.c b/src/modules/history_backend_mem.c index b68a52405..b35c1229a 100644 --- a/src/modules/history_backend_mem.c +++ b/src/modules/history_backend_mem.c @@ -431,6 +431,9 @@ int hbm_modechar_del(Channel *channel, int modechar) { HistoryLogObject *h; + if (!cfg.persist) + return 0; + if ((modechar == 'P') && ((h = hbm_find_object(channel->chname)))) { /* Channel went from +P to -P and also has channel history: delete the history file */ @@ -1162,6 +1165,14 @@ static int hbm_write_db(HistoryLogObject *h) static void hbm_delete_db(HistoryLogObject *h) { UnrealDB *db; - char *fname = hbm_history_filename(h); + char *fname; + if (!cfg.persist || !cfg.prehash || !cfg.posthash) + { +#ifdef DEBUGMODE + abort(); /* we should not be called, so debug this */ +#endif + return; + } + fname = hbm_history_filename(h); unlink(fname); }