Avoid passing 0 to realloc in ReadPhondataManifest(compiledata.c). [clang scan-build]

This commit is contained in:
Reece H. Dunn
2016-01-07 20:46:31 +00:00
parent 5453616ec9
commit dea7d441f2
3 changed files with 9 additions and 0 deletions
+1
View File
@@ -50,6 +50,7 @@ typedef enum {
ENS_NOT_SUPPORTED = 0x10000AFF,
ENS_UNSUPPORTED_PHON_FORMAT = 0x10000BFF,
ENS_NO_SPECT_FRAMES = 0x10000CFF,
ENS_EMPTY_PHONEME_MANIFEST = 0x10000DFF,
} espeak_ng_STATUS;
typedef enum {
+5
View File
@@ -409,6 +409,11 @@ static espeak_ng_STATUS ReadPhondataManifest(espeak_ng_ERROR_CONTEXT *context)
free(manifest[ix].name);
}
if (n_lines == 0) {
fclose(f);
return ENS_EMPTY_PHONEME_MANIFEST;
}
if ((manifest = (NAMETAB *)realloc(manifest, n_lines * sizeof(NAMETAB))) == NULL) {
fclose(f);
return ENOMEM;
+3
View File
@@ -116,6 +116,9 @@ ESPEAK_NG_API void espeak_ng_GetStatusCodeMessage(espeak_ng_STATUS status, char
case ENS_NO_SPECT_FRAMES:
strncpy0(buffer, "The spectral file does not contain any frame data", length);
break;
case ENS_EMPTY_PHONEME_MANIFEST:
strncpy0(buffer, "The phoneme manifest file does not contain any phonemes", length);
break;
default:
if ((status & ENS_GROUP_MASK) == ENS_GROUP_ERRNO)
strerror_r(status, buffer, length);