From f780f9ccfc4c27decca1c28b1e8bc7628f2fc9f4 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 25 Nov 2015 17:20:11 +0100 Subject: bpfc: Check yyin against NULL before calling fclose() on it Follow 3f2f363485d3 ("trafgen: Make sure yyin is set before close it") and check the yyin pointer against NULL before attempting to call fclose() with it. Signed-off-by: Tobias Klauser --- bpf_parser.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpf_parser.y b/bpf_parser.y index 8aed9dc..003c031 100644 --- a/bpf_parser.y +++ b/bpf_parser.y @@ -810,7 +810,7 @@ int compile_filter(char *file, int verbose, int bypass, int format, free(labels_k[i]); } - if (yyin != stdin) + if (yyin && yyin != stdin) fclose(yyin); exit: -- cgit v1.2.3-54-g00ecf