From c0a3c6bb9dca588f999992d9b4ea1deccd513d27 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 5 May 2016 15:14:57 -0600 Subject: [PATCH] Avoid calling fclose(NULL) on error in export_sudoers(). Coverity CID 104091. --- plugins/sudoers/visudo_json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sudoers/visudo_json.c b/plugins/sudoers/visudo_json.c index 200852fa7..ca1ecc68d 100644 --- a/plugins/sudoers/visudo_json.c +++ b/plugins/sudoers/visudo_json.c @@ -1062,7 +1062,7 @@ export_sudoers(const char *sudoers_path, const char *export_path, fputs("\n}\n", export_fp); done: - if (export_fp != stdout) + if (export_fp != stdout && export_fp != NULL) fclose(export_fp); debug_return_bool(ok); } -- 2.50.1