Added error messages when no RAM lol

This commit is contained in:
Casey 2022-09-13 20:22:56 +03:00
parent 06b5c3016f
commit d3fb717d2d
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
2 changed files with 3 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.elf
main

2
main.c
View File

@ -93,10 +93,12 @@ int main(int argc, char **argv) {
OddBlock *block_init(uint64_t start) {
OddBlock *blk = calloc(1, sizeof(OddBlock));
if (blk == NULL) {
printf("Failed to allocate a new block: %zd\n", start);
n_allocs_failed++;
return NULL;
}
if ((blk->block = malloc(0x1000000)) == NULL) {
printf("Failed to allocate a new block contents: %zd\n", start);
free(blk);
n_allocs_failed++;
return NULL;