diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2017-02-19 18:12:03 +0100 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-02-21 14:35:41 -0500 |
commit | 1d5936e478194798a287e165b81d27a1bcceaae8 (patch) | |
tree | dddbcf4e246e819e0f7c077e2c1adb8d86928e57 /apps | |
parent | c6a9f005be1cf8e29a0985643b27b9548bcfdee2 (diff) |
Fix a few memleaks in TXT_DB.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2684)
(cherry picked from commit 9ad52c562a93c9a57ae3024e54c575430753244c)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/ca.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1838,10 +1838,8 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, } irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row space"); - for (i = 0; i < DB_NUMBER; i++) { + for (i = 0; i < DB_NUMBER; i++) irow[i] = row[i]; - row[i] = NULL; - } irow[DB_NUMBER] = NULL; if (!TXT_DB_insert(db->db, irow)) { @@ -1849,10 +1847,14 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); goto end; } + irow = NULL; ok = 1; end: - for (i = 0; i < DB_NUMBER; i++) - OPENSSL_free(row[i]); + if (irow != NULL) { + for (i = 0; i < DB_NUMBER; i++) + OPENSSL_free(row[i]); + OPENSSL_free(irow); + } X509_NAME_free(CAname); X509_NAME_free(subject); |