From e84f2cf17d3d9502df11be91e89decbb6e0354b1 Mon Sep 17 00:00:00 2001 From: Adrian Szyndela Date: Tue, 17 Dec 2019 13:40:36 +0100 Subject: [PATCH] memory: allow lowmem_limit to reinit for tests This sets memory_limit_hash to NULL after freeing memory associated with it. This way we can initialize the module again. It helps with performing consecutive tests within a single binary. Change-Id: Icfe2755c1d7689a314d04d0056c9cac05bdafcd7 --- src/memory/lowmem-limit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/memory/lowmem-limit.c b/src/memory/lowmem-limit.c index a289659..bca5834 100644 --- a/src/memory/lowmem-limit.c +++ b/src/memory/lowmem-limit.c @@ -651,8 +651,12 @@ void lowmem_limit_init(void) void lowmem_limit_exit(void) { - if (memory_limit_hash) + if (memory_limit_hash) { g_hash_table_destroy(memory_limit_hash); +#ifdef _UNIT_TEST + memory_limit_hash = NULL; +#endif + } if (mem_service_limit) unregister_notifier(RESOURCED_NOTIFIER_SERVICE_LAUNCH, lowmem_limit_service); -- 2.7.4