mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-12-03 06:55:44 +00:00
Fix a null pointer dereference in LoadSpectSeq(spect.c). [Coverity]
This commit is contained in:
@@ -304,7 +304,10 @@ espeak_ng_STATUS LoadSpectSeq(SpectSeq *spect, const char *filename)
|
|||||||
|
|
||||||
fread(&name_len, sizeof(uint32_t), 1, stream);
|
fread(&name_len, sizeof(uint32_t), 1, stream);
|
||||||
if (name_len > 0) {
|
if (name_len > 0) {
|
||||||
spect->name = (char *)malloc(name_len);
|
if ((spect->name = (char *)malloc(name_len)) == NULL) {
|
||||||
|
fclose(stream);
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
fread(spect->name, sizeof(char), name_len, stream);
|
fread(spect->name, sizeof(char), name_len, stream);
|
||||||
} else
|
} else
|
||||||
spect->name = NULL;
|
spect->name = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user