]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
scan-build: close stdio FILEs on error in tor-gencert
authorNick Mathewson <nickm@torproject.org>
Sat, 19 Apr 2014 16:47:58 +0000 (12:47 -0400)
committerNick Mathewson <nickm@torproject.org>
Sat, 19 Apr 2014 16:47:58 +0000 (12:47 -0400)
This is harmless, since tor-gencert exits right afterwards, but it's
best to clean up after ourselves.

src/tools/tor-gencert.c

index d0c30b8b0233f174b2499c7af297066fb7cb4c39..e799df5cad7597d3ad305d31d9ecc75337e9b02a 100644 (file)
@@ -302,6 +302,7 @@ load_identity_key(void)
     if (!identity_key) {
       log_err(LD_GENERAL, "Couldn't read identity key from %s",
               identity_key_file);
+      fclose(f);
       return 1;
     }
     fclose(f);
@@ -322,6 +323,7 @@ load_signing_key(void)
   }
   if (!(signing_key = PEM_read_PrivateKey(f, NULL, NULL, NULL))) {
     log_err(LD_GENERAL, "Couldn't read siging key from %s", signing_key_file);
+    fclose(f);
     return 1;
   }
   fclose(f);