1
0
Fork 0

HTS: fix a crash if malloc returns null

This is probably only a partial fix, but won’t hurt.

Sentry-Id: FLIGHTGEAR-39N
This commit is contained in:
James Turner 2020-12-18 14:02:03 +00:00
parent 0e545d711c
commit ec30b0d5db

View file

@ -565,12 +565,11 @@ void *HTS_calloc(const size_t num, const size_t size)
#else
mem = (void *) malloc(n);
#endif /* FESTIVAL */
if (mem == NULL) {
HTS_error(1, "HTS_calloc: Cannot allocate memory.\n");
}
memset(mem, 0, n);
if (mem == NULL)
HTS_error(1, "HTS_calloc: Cannot allocate memory.\n");
return mem;
}