function code exit, some error on malloc and realloc handled with exit code