From ec30b0d5dbdc43c3a542b07b979935c39ea000f0 Mon Sep 17 00:00:00 2001 From: James Turner Date: Fri, 18 Dec 2020 14:02:03 +0000 Subject: [PATCH] HTS: fix a crash if malloc returns null MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is probably only a partial fix, but won’t hurt. Sentry-Id: FLIGHTGEAR-39N --- 3rdparty/hts_engine_API/lib/HTS_misc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/3rdparty/hts_engine_API/lib/HTS_misc.c b/3rdparty/hts_engine_API/lib/HTS_misc.c index 6a350fce2..d4ff2d4e3 100755 --- a/3rdparty/hts_engine_API/lib/HTS_misc.c +++ b/3rdparty/hts_engine_API/lib/HTS_misc.c @@ -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; }