Bugzilla Bug 345941: fixed the bug that we might pass uninitialized 'req'

to fclose(). r=glen.beasley.  Thanks to Wolfgang Rosenauer
<mozilla@rosenauer.org> for the bug report.
This commit is contained in:
wtchang%redhat.com 2006-07-27 16:56:56 +00:00
Родитель 107e12ab56
Коммит c9e31d8b88
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -3088,8 +3088,8 @@ void hmac_test(char *reqfn)
unsigned char HMAC[HASH_LENGTH_MAX]; /* computed HMAC */
HASH_HashType hash_alg; /* HMAC type */
FILE *req; /* input stream from the REQUEST file */
FILE *resp; /* output stream to the RESPONSE file */
FILE *req = NULL; /* input stream from the REQUEST file */
FILE *resp; /* output stream to the RESPONSE file */
buf = PORT_ZAlloc(bufSize);
if (buf == NULL) {
@ -3201,7 +3201,9 @@ void hmac_test(char *reqfn)
}
}
loser:
fclose(req);
if (req) {
fclose(req);
}
if (buf) {
PORT_ZFree(buf, bufSize);
}