]> granicus.if.org Git - sudo/commitdiff
Avoid calling fclose(NULL) on error in export_sudoers().
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 May 2016 21:14:57 +0000 (15:14 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 May 2016 21:14:57 +0000 (15:14 -0600)
Coverity CID 104091.

plugins/sudoers/visudo_json.c

index 200852fa780c0ac08762610fe643bada0bd12610..ca1ecc68d101d7eebd06078fa97413cc352c06a5 100644 (file)
@@ -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);
 }