[PATCH] lib: fwts_alloc: fix incorrect accounting on hash entry count

Colin King colin.king at canonical.com
Sat Feb 25 16:35:57 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

When hash entries are re-used we also need to bump the count of active
entries to ensure we are tallying these correctly.  This fixes a
non-fatal issue where the accounting believes that all entries are freed
when there could be some still being active and we end up prematurely
cleaning up the hash table too early.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_alloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/lib/src/fwts_alloc.c b/src/lib/src/fwts_alloc.c
index f07cab8..c0d5e55 100644
--- a/src/lib/src/fwts_alloc.c
+++ b/src/lib/src/fwts_alloc.c
@@ -73,6 +73,7 @@ static bool hash_alloc_add(void *addr, size_t size)
 			/* old and free, so re-use */
 			new->addr = addr;
 			new->size = size;
+			hash_count++;
 			return true;
 		}
 		/* something is wrong, already in use */
-- 
2.10.2




More information about the fwts-devel mailing list