mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-21 21:17:19 +00:00
[client] util: fix failure to check result of ftell
for error
This commit is contained in:
parent
9f3f8cc5bd
commit
17fce1cf78
@ -48,7 +48,6 @@ bool util_fileGetContents(const char * filename, char ** buffer, size_t * length
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
long fsize = ftell(fh);
|
|
||||||
if (fseek(fh, 0, SEEK_SET) != 0)
|
if (fseek(fh, 0, SEEK_SET) != 0)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("Failed to seek");
|
DEBUG_ERROR("Failed to seek");
|
||||||
@ -56,6 +55,14 @@ bool util_fileGetContents(const char * filename, char ** buffer, size_t * length
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long fsize = ftell(fh);
|
||||||
|
if (fsize < 0)
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("Failed to get the size");
|
||||||
|
fclose(fh);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
*buffer = malloc(fsize + 1);
|
*buffer = malloc(fsize + 1);
|
||||||
if (!*buffer)
|
if (!*buffer)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user