提交 5219d3dd 编写于 作者: D Dr. Stephen Henson

Fix free errors in ocsp utility.

Keep copy of any host, path and port values allocated by
OCSP_parse_url and free as necessary.
上级 476830fd
...@@ -127,6 +127,7 @@ int MAIN(int argc, char **argv) ...@@ -127,6 +127,7 @@ int MAIN(int argc, char **argv)
ENGINE *e = NULL; ENGINE *e = NULL;
char **args; char **args;
char *host = NULL, *port = NULL, *path = "/"; char *host = NULL, *port = NULL, *path = "/";
char *thost = NULL, *tport = NULL, *tpath = NULL;
char *reqin = NULL, *respin = NULL; char *reqin = NULL, *respin = NULL;
char *reqout = NULL, *respout = NULL; char *reqout = NULL, *respout = NULL;
char *signfile = NULL, *keyfile = NULL; char *signfile = NULL, *keyfile = NULL;
...@@ -206,6 +207,12 @@ int MAIN(int argc, char **argv) ...@@ -206,6 +207,12 @@ int MAIN(int argc, char **argv)
} }
else if (!strcmp(*args, "-url")) else if (!strcmp(*args, "-url"))
{ {
if (thost)
OPENSSL_free(thost);
if (tport)
OPENSSL_free(tport);
if (tpath)
OPENSSL_free(tpath);
if (args[1]) if (args[1])
{ {
args++; args++;
...@@ -214,6 +221,9 @@ int MAIN(int argc, char **argv) ...@@ -214,6 +221,9 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err, "Error parsing URL\n"); BIO_printf(bio_err, "Error parsing URL\n");
badarg = 1; badarg = 1;
} }
thost = host;
tport = port;
tpath = path;
} }
else badarg = 1; else badarg = 1;
} }
...@@ -963,12 +973,12 @@ end: ...@@ -963,12 +973,12 @@ end:
sk_X509_pop_free(verify_other, X509_free); sk_X509_pop_free(verify_other, X509_free);
sk_CONF_VALUE_pop_free(headers, X509V3_conf_free); sk_CONF_VALUE_pop_free(headers, X509V3_conf_free);
if (use_ssl != -1) if (thost)
{ OPENSSL_free(thost);
OPENSSL_free(host); if (tport)
OPENSSL_free(port); OPENSSL_free(tport);
OPENSSL_free(path); if (tpath)
} OPENSSL_free(tpath);
OPENSSL_EXIT(ret); OPENSSL_EXIT(ret);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册