diff options
author | Bernd Edlinger <bernd.edlinger@hotmail.de> | 2017-02-19 20:47:45 +0100 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-02-21 14:36:40 -0500 |
commit | 342843884a68a480aaa8fa5c2767c3a9a2a38bf8 (patch) | |
tree | f6ac58ff0debee10354bd62db027722f8ec8d0f2 /apps | |
parent | 646e6bd40e4ad069e075530a7531f1ac2a9e3fc0 (diff) |
Fix some more memory leaks with TXT_DB_insert.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2685)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/ca.c | 8 | ||||
-rw-r--r-- | apps/srp.c | 4 |
2 files changed, 6 insertions, 6 deletions
@@ -2397,18 +2397,20 @@ static int do_revoke(X509 *x509, CA_DB *db, int type, char *value) goto err; } - 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)) { BIO_printf(bio_err, "failed to update database\n"); BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); + OPENSSL_free(irow); goto err; } + for (i = 0; i < DB_NUMBER; i++) + row[i] = NULL; + /* Revoke Certificate */ if (type == -1) ok = 1; diff --git a/apps/srp.c b/apps/srp.c index 37341a5d20..ce01a24f2a 100644 --- a/apps/srp.c +++ b/apps/srp.c @@ -183,10 +183,8 @@ static int update_index(CA_DB *db, BIO *bio, char **row) return 0; } - 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)) { |