diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2014-04-09 15:42:40 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2014-04-09 15:45:56 +0100 |
commit | c61f0cbffb7f9944d49d5a9fb34eb26b1cbe9956 (patch) | |
tree | 354f70093ad2640aaae954a136d8988d1e6b88db | |
parent | d90605dd004d51152f35d3ce89f897c4e615ec12 (diff) |
Fix free errors in ocsp utility.
Keep copy of any host, path and port values allocated by
OCSP_parse_url and free as necessary.
(cherry picked from commit 5219d3dd350cc74498dd49daef5e6ee8c34d9857)
-rw-r--r-- | apps/ocsp.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/apps/ocsp.c b/apps/ocsp.c index 251044d77f..891f3ee806 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -98,6 +98,7 @@ int MAIN(int argc, char **argv) ENGINE *e = NULL; char **args; char *host = NULL, *port = NULL, *path = "/"; + char *thost = NULL, *tport = NULL, *tpath = NULL; char *reqin = NULL, *respin = NULL; char *reqout = NULL, *respout = NULL; char *signfile = NULL, *keyfile = NULL; @@ -173,6 +174,12 @@ int MAIN(int argc, char **argv) } else if (!strcmp(*args, "-url")) { + if (thost) + OPENSSL_free(thost); + if (tport) + OPENSSL_free(tport); + if (tpath) + OPENSSL_free(tpath); if (args[1]) { args++; @@ -181,6 +188,9 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "Error parsing URL\n"); badarg = 1; } + thost = host; + tport = port; + tpath = path; } else badarg = 1; } @@ -871,12 +881,12 @@ end: sk_X509_pop_free(sign_other, X509_free); sk_X509_pop_free(verify_other, X509_free); - if (use_ssl != -1) - { - OPENSSL_free(host); - OPENSSL_free(port); - OPENSSL_free(path); - } + if (thost) + OPENSSL_free(thost); + if (tport) + OPENSSL_free(tport); + if (tpath) + OPENSSL_free(tpath); OPENSSL_EXIT(ret); } |