memory: allow lowmem_limit to reinit for tests 49/220349/1
authorAdrian Szyndela <adrian.s@samsung.com>
Tue, 17 Dec 2019 12:40:36 +0000 (13:40 +0100)
committerAdrian Szyndela <adrian.s@samsung.com>
Tue, 17 Dec 2019 12:43:04 +0000 (13:43 +0100)
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

index a289659..bca5834 100644 (file)
@@ -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);