Exit test program in case of malloc fail submit/tizen/20210831.013333
authorKunhoon Baik <knhoon.baik@samsung.com>
Tue, 31 Aug 2021 01:31:40 +0000 (10:31 +0900)
committerKunhoon Baik <knhoon.baik@samsung.com>
Tue, 31 Aug 2021 01:31:40 +0000 (10:31 +0900)
test/memory_syscall_test.cc

index 91e2a21a0420f2f4f9993844b676e9869067abbc..7c14621965232814363b90f59448bbb12233e8c2 100644 (file)
@@ -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);