ftell can return -1 to indicate error, so trap for that.

Fixes Coverity CID1039356

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-11-18 11:58:39 +00:00
parent 164269a2da
commit 41a700b2d5
1 changed files with 7 additions and 0 deletions

View File

@ -269,6 +269,13 @@ do_eet_insert(const char *file,
fseek(f, 0, SEEK_END);
size = ftell(f);
if (size < 0)
{
ERR("cannot obtain current file position %s", out);
fclose(f);
exit(-1);
}
rewind(f);
data = malloc(size);
if (!data)