From dfbd54466e83b8c545da931db73f6c0ac73ae136 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 19 Jul 2018 16:55:58 +0200 Subject: [PATCH] * src/fa.c (fa_dot_debug): check result of fopen Return earlier if fopen fails, otherwise fa_dot will dereference a null pointer. (cherry picked from commit 2fd3692404cd4290f106bc6886e6cba949452fa0) --- src/fa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fa.c b/src/fa.c index 412d1394..8e1d7d47 100644 --- a/src/fa.c +++ b/src/fa.c @@ -286,6 +286,11 @@ static void fa_dot_debug(struct fa *fa, const char *tag) { return; fp = fopen(fname, "w"); + if (fp == NULL) { + free(fname); + return; + } + fa_dot(fp, fa); fclose(fp); free(fname); -- 2.17.2