From adcd55edddc105e1eabf00e33417f96fcf66f685 Mon Sep 17 00:00:00 2001 From: Kunhoon Baik Date: Tue, 31 Aug 2021 10:31:40 +0900 Subject: [PATCH] Exit test program in case of malloc fail --- test/memory_syscall_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/memory_syscall_test.cc b/test/memory_syscall_test.cc index 91e2a21..7c14621 100644 --- a/test/memory_syscall_test.cc +++ b/test/memory_syscall_test.cc @@ -10,8 +10,11 @@ int main() int pid; while(1){ a = (char*)calloc(1000*1000,sizeof(char)); - if (a == NULL) + if (a == NULL){ printf("not enough memory\n"); + return -1; + } + for(i=0; i<1000*1000;i++) a[i]=(char)i; usleep(100*1000); -- 2.34.1