test: fail if fgets() from addr2line returns NULL
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 25 May 2015 07:04:56 +0000 (17:04 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 25 May 2015 07:30:08 +0000 (17:30 +1000)
Found by Coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test/litest.c

index 037186f..7a4938d 100644 (file)
@@ -99,7 +99,10 @@ litest_backtrace_get_lineno(const char *executable,
        }
 
        buffer[0] = '?';
-       fgets(buffer, sizeof(buffer), f);
+       if (fgets(buffer, sizeof(buffer), f) == NULL) {
+               pclose(f);
+               return false;
+       }
        pclose(f);
 
        if (buffer[0] == '?')