Call to malloc may return NULL in create_*_error_context(error.c) [msvc /analyze]

This commit is contained in:
Reece H. Dunn
2016-01-11 20:42:19 +00:00
parent 242cb51c38
commit 6b573e112b
+4
View File
@@ -38,6 +38,8 @@ espeak_ng_STATUS create_file_error_context(espeak_ng_ERROR_CONTEXT *context, esp
free((*context)->path);
} else {
*context = malloc(sizeof(espeak_ng_ERROR_CONTEXT_));
if (!*context)
return ENOMEM;
}
(*context)->type = ERROR_CONTEXT_FILE;
(*context)->path = strdup(filename);
@@ -54,6 +56,8 @@ espeak_ng_STATUS create_version_mismatch_error_context(espeak_ng_ERROR_CONTEXT *
free((*context)->path);
} else {
*context = malloc(sizeof(espeak_ng_ERROR_CONTEXT_));
if (!*context)
return ENOMEM;
}
(*context)->type = ERROR_CONTEXT_VERSION;
(*context)->path = strdup(path_home);