Skip to contentSkip to conversation

Fix use of results after being unmapped

PATCH New Yann Sionneau 2 participants 2 messages Jun 14, 2019 Library code

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Fix use of results after being unmapped

This fixes issue reported there: https://github.com/linux-test-project/ltp/issues/537

---
 lib/tst_test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
lib/tst_test.c +3 -2
index 95f389d..7395996 100644
@@ -138,6 +138,7 @@ static void cleanup_ipc(void)
 	if (results) {
 		msync((void*)results, size, MS_SYNC);
 		munmap((void*)results, size);
+		results = NULL;
 	}
 }
 
@@ -921,10 +922,10 @@ static void do_cleanup(void)
 	if (tst_test->save_restore)
 		tst_sys_conf_restore(0);
 
-	cleanup_ipc();
-
 	if (tst_test->restore_wallclock)
 		tst_wallclock_restore();
+
+	cleanup_ipc();
 }
 
 static void run_tests(void)
Signature · 1 line
1.8.3.1