Fixes clang analyzer warning:

bufio.c:165:13: warning: Access to field 'bufp' results in a dereference
 of a null pointer (loaded from variable 'f')
    f->bufp = f->buffer;
    ~       ^

Signed-off-by: Alan Coopersmith <[email protected]>
---
 src/fontfile/bufio.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/fontfile/bufio.c b/src/fontfile/bufio.c
index 34b7f36..d8d4f29 100644
--- a/src/fontfile/bufio.c
+++ b/src/fontfile/bufio.c
@@ -162,8 +162,10 @@ BufFileOpenWrite (int fd)
     setmode(fd,O_BINARY);
 #endif
     f = BufFileCreate ((char *)(long) fd, 0, BufFileRawFlush, 0, BufFileFlush);
-    f->bufp = f->buffer;
-    f->left = BUFFILESIZE;
+    if (f != NULL) {
+       f->bufp = f->buffer;
+       f->left = BUFFILESIZE;
+    }
     return f;
 }
 
-- 
1.7.9.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to