[cairo] [PATCH] [perf] Don't dereference NULL upon malloc failure.
Jim Meyering
jim at meyering.net
Sun Jan 6 05:55:42 PST 2008
* cairo-perf-diff-files.c (getline): Return -1 also upon malloc failure.
Signed-off-by: Jim Meyering <meyering at redhat.com>
---
perf/cairo-perf-diff-files.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/perf/cairo-perf-diff-files.c b/perf/cairo-perf-diff-files.c
index 5fdf72d..4aab477 100644
--- a/perf/cairo-perf-diff-files.c
+++ b/perf/cairo-perf-diff-files.c
@@ -267,7 +267,7 @@ getline (char **lineptr, size_t *n, FILE *stream)
*lineptr = (char *) malloc (*n);
}
- if (!fgets (*lineptr, *n, stream))
+ if (*lineptr == NULL || !fgets (*lineptr, *n, stream))
return -1;
if (!feof (stream) && !strchr (*lineptr, '\n'))
--
1.5.4.rc2.39.g6989c5
More information about the cairo
mailing list