Bug 1070493 - file descriptor leak in secu_InitSlotPassword in nss/cmd/lib/secutil.c, r=rrelyea
authorSachin Kumar Gupta <s.k.gupta@samsung.com>
Mon, 13 Oct 2014 17:04:40 +0200
changeset 11291 e982d1ffdca7b460b59a96a723a4eac44882ecd3
parent 11290 fa30068a27e4970f2480a40436e2f0293a02d4b1
child 11292 34baf87d485dc01fc67ab5a8334cd7b55bce0f6e
push id502
push userkaie@kuix.de
push dateMon, 13 Oct 2014 15:04:48 +0000
reviewersrrelyea
bugs1070493
Bug 1070493 - file descriptor leak in secu_InitSlotPassword in nss/cmd/lib/secutil.c, r=rrelyea
cmd/lib/secutil.c
--- a/cmd/lib/secutil.c
+++ b/cmd/lib/secutil.c
@@ -286,16 +286,19 @@ secu_InitSlotPassword(PK11SlotInfo *slot
     PR_fprintf(PR_STDERR, 
         "Enter a password which will be used to encrypt your keys.\n"
      	"The password should be at least 8 characters long,\n"
      	"and should contain at least one non-alphabetic character.\n\n");
 
     output = fopen(consoleName, "w");
     if (output == NULL) {
 	PR_fprintf(PR_STDERR, "Error opening output terminal for write\n");
+#ifndef _WINDOWS
+	fclose(input);
+#endif
 	return NULL;
     }
 
 
     for (;;) {
 	if (p0) 
 	    PORT_Free(p0);
 	p0 = SEC_GetPassword(input, output, "Enter new password: ",