summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinson Lee <[email protected]>2009-11-20 11:34:21 -0800
committerVinson Lee <[email protected]>2009-11-20 11:34:21 -0800
commitc88b18a4df753205321ce1f7ddcd99244b670a1e (patch)
treec2c848f4e5ea3fc3302710eb350cf973b68fe8e7
parentd36cb2396c942f05ba56c5b899792a507bb0f0fd (diff)
progs/slang: Check for ftell failure in vstest.c.
-rw-r--r--progs/slang/vstest.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/progs/slang/vstest.c b/progs/slang/vstest.c
index 472ea9b62e2..33c6f09dc55 100644
--- a/progs/slang/vstest.c
+++ b/progs/slang/vstest.c
@@ -220,6 +220,12 @@ static void load_test_file (const char *filename)
fseek (f, 0, SEEK_END);
size = ftell (f);
+
+ if (size == -1) {
+ fclose (f);
+ return;
+ }
+
fseek (f, 0, SEEK_SET);
code = (char *) (malloc (size));