From: Todd C. Miller Date: Thu, 5 May 2016 21:14:57 +0000 (-0600) Subject: Avoid calling fclose(NULL) on error in export_sudoers(). X-Git-Tag: SUDO_1_8_17^2~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c0a3c6bb9dca588f999992d9b4ea1deccd513d27;p=sudo Avoid calling fclose(NULL) on error in export_sudoers(). Coverity CID 104091. --- 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); }