background image: use xmalloc instead of malloc to exit st on malloc failures

This commit is contained in:
bakkeby 2022-03-11 10:17:31 +01:00
parent faac64e392
commit 289485bd50
1 changed files with 1 additions and 1 deletions

View File

@ -35,7 +35,7 @@ loadff(const char *filename)
w = ntohl(hdr[2]);
h = ntohl(hdr[3]);
size = w * h;
data = malloc(size * sizeof(uint64_t));
data = xmalloc(size * sizeof(uint64_t));
if (fread(data, sizeof(uint64_t), size, f) != size) {
fprintf(stderr, "fread: %s\n", ferror(f) ? "" : "Unexpected end of file reading data");