summaryrefslogtreecommitdiffstats
path: root/crypto/ocsp
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-05-10 13:41:06 -0400
committerRich Salz <rsalz@openssl.org>2016-05-10 13:41:06 -0400
commit74d6762543335641e4155fd84deaba67cd0105e4 (patch)
treeb3b4380cc92ab4e88d1ec1b21becc1729a60dd92 /crypto/ocsp
parent2f460e1adb4b32addb390428e8a98c7169d46bfc (diff)
GH837: Avoid double-free in OCSP parse.
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'crypto/ocsp')
-rw-r--r--crypto/ocsp/ocsp_lib.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/ocsp/ocsp_lib.c b/crypto/ocsp/ocsp_lib.c
index cabf53933a..ff781e56e7 100644
--- a/crypto/ocsp/ocsp_lib.c
+++ b/crypto/ocsp/ocsp_lib.c
@@ -271,12 +271,18 @@ int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath,
err:
if (buf)
OPENSSL_free(buf);
- if (*ppath)
+ if (*ppath) {
OPENSSL_free(*ppath);
- if (*pport)
+ *ppath = NULL;
+ }
+ if (*pport) {
OPENSSL_free(*pport);
- if (*phost)
+ *pport = NULL;
+ }
+ if (*phost) {
OPENSSL_free(*phost);
+ *phost = NULL;
+ }
return 0;
}