Fix a possible memleak in apps/rehash.c

The OPENSSL_DIR_end was missing in case of error.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22920)
This commit is contained in:
Bernd Edlinger 2023-12-03 11:29:52 +01:00 committed by Tomas Mraz
parent ba4d833f6e
commit 01709fcb8b
1 changed files with 1 additions and 0 deletions

View File

@ -383,6 +383,7 @@ static int do_dir(const char *dirname, enum Hash h)
if ((copy = OPENSSL_strdup(filename)) == NULL
|| sk_OPENSSL_STRING_push(files, copy) == 0) {
OPENSSL_free(copy);
OPENSSL_DIR_end(&d);
BIO_puts(bio_err, "out of memory\n");
errs = 1;
goto err;