projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
coverity 1462556 Resource leak
[openssl.git]
/
apps
/
rehash.c
diff --git
a/apps/rehash.c
b/apps/rehash.c
index de54064244594804db0cca6818d70e70279e45fd..866b8cfe206d5ba501a075bd3f6e67d03b01b764 100644
(file)
--- a/
apps/rehash.c
+++ b/
apps/rehash.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 2015-20
18
The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-20
20
The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2013-2014 Timo Teräs <timo.teras@gmail.com>
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* Copyright (c) 2013-2014 Timo Teräs <timo.teras@gmail.com>
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
@@
-42,6
+42,8
@@
# include <openssl/pem.h>
# include <openssl/x509.h>
# include <openssl/pem.h>
# include <openssl/x509.h>
+DEFINE_STACK_OF(X509_INFO)
+DEFINE_STACK_OF_STRING()
# ifndef PATH_MAX
# define PATH_MAX 4096
# ifndef PATH_MAX
# define PATH_MAX 4096
@@
-233,7
+235,7
@@
static int do_file(const char *filename, const char *fullpath, enum Hash h)
{
STACK_OF (X509_INFO) *inf = NULL;
X509_INFO *x;
{
STACK_OF (X509_INFO) *inf = NULL;
X509_INFO *x;
- X509_NAME *name = NULL;
+
const
X509_NAME *name = NULL;
BIO *b;
const char *ext;
unsigned char digest[EVP_MAX_MD_SIZE];
BIO *b;
const char *ext;
unsigned char digest[EVP_MAX_MD_SIZE];
@@
-274,11
+276,19
@@
static int do_file(const char *filename, const char *fullpath, enum Hash h)
if (x->x509 != NULL) {
type = TYPE_CERT;
name = X509_get_subject_name(x->x509);
if (x->x509 != NULL) {
type = TYPE_CERT;
name = X509_get_subject_name(x->x509);
- X509_digest(x->x509, evpmd, digest, NULL);
+ if (!X509_digest(x->x509, evpmd, digest, NULL)) {
+ BIO_printf(bio_err, "out of memory\n");
+ ++errs;
+ goto end;
+ }
} else if (x->crl != NULL) {
type = TYPE_CRL;
name = X509_CRL_get_issuer(x->crl);
} else if (x->crl != NULL) {
type = TYPE_CRL;
name = X509_CRL_get_issuer(x->crl);
- X509_CRL_digest(x->crl, evpmd, digest, NULL);
+ if (!X509_CRL_digest(x->crl, evpmd, digest, NULL)) {
+ BIO_printf(bio_err, "out of memory\n");
+ ++errs;
+ goto end;
+ }
} else {
++errs;
goto end;
} else {
++errs;
goto end;