From ebc1531ecc044ae5b51816506e458155ae44c5c4 Mon Sep 17 00:00:00 2001 From: buslov Date: Mon, 30 Oct 2017 20:58:28 +0300 Subject: [PATCH] Fix V575 warning from PVS-Studio Static Analyzer There might be dereferencing of a potential null pointer 'Node'. --- src/ast.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ast.c b/src/ast.c index 88ea491..23121ff 100644 --- a/src/ast.c +++ b/src/ast.c @@ -9,8 +9,10 @@ ast* astCreate (astTag tag, tokenLocation location) { ast* Node = calloc(1, sizeof(ast)); - Node->tag = tag; - Node->location = location; + if (Node) { + Node->tag = tag; + Node->location = location; + } return Node; }