提交 0bd2d76b 编写于 作者: B Behdad Esfahbod

[test] Fix a couple of coverity_scan issues

上级 8089711a
......@@ -40,18 +40,23 @@ hb_subset_test_read_file (const char *path,
{
FILE *fp = fopen (path, "rb");
size_t file_length = 0;
long file_length = 0;
char *buffer = NULL;
if (fp && fseek (fp, 0, SEEK_END) == 0) {
if (fp && fseek (fp, 0, SEEK_END) == 0)
{
file_length = ftell(fp);
rewind (fp);
}
if (file_length > 0) {
buffer = (char *) calloc (file_length + 1, sizeof(char));
if (fread (buffer, 1, file_length, fp) == file_length) {
if (file_length > 0)
{
buffer = (char *) calloc (file_length + 1, sizeof (char));
if (buffer && fread (buffer, 1, file_length, fp) == (size_t) file_length)
{
*length = file_length;
} else {
}
else
{
free (buffer);
buffer = NULL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册