From 7873d811a09abb4fec57945ccf2a30442cea9dfd Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Tue, 27 Feb 2024 21:39:34 -0600 Subject: [PATCH] Fixed memory leak in emubd's out-of-order write emulation We need to decrement the saved block state on sync, when we reset out-of-order emulation. Otherwise we leak blocks out the wazoo. --- bd/lfs_emubd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bd/lfs_emubd.c b/bd/lfs_emubd.c index 3f6183c..a734bc2 100644 --- a/bd/lfs_emubd.c +++ b/bd/lfs_emubd.c @@ -531,6 +531,7 @@ int lfs_emubd_sync(const struct lfs_config *cfg) { // emulate out-of-order writes? reset first write, writes // cannot be out-of-order across sync if (bd->cfg->powerloss_behavior == LFS_EMUBD_POWERLOSS_OOO) { + lfs_emubd_decblock(bd->ooo_data); bd->ooo_block = -1; bd->ooo_data = NULL; }