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:
parent
0e545d711c
commit
ec30b0d5db
1 changed files with 3 additions and 4 deletions
7
3rdparty/hts_engine_API/lib/HTS_misc.c
vendored
7
3rdparty/hts_engine_API/lib/HTS_misc.c
vendored
|
@ -565,12 +565,11 @@ void *HTS_calloc(const size_t num, const size_t size)
|
||||||
#else
|
#else
|
||||||
mem = (void *) malloc(n);
|
mem = (void *) malloc(n);
|
||||||
#endif /* FESTIVAL */
|
#endif /* FESTIVAL */
|
||||||
|
if (mem == NULL) {
|
||||||
|
HTS_error(1, "HTS_calloc: Cannot allocate memory.\n");
|
||||||
|
}
|
||||||
|
|
||||||
memset(mem, 0, n);
|
memset(mem, 0, n);
|
||||||
|
|
||||||
if (mem == NULL)
|
|
||||||
HTS_error(1, "HTS_calloc: Cannot allocate memory.\n");
|
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue