diff options
author | Jonas Maebe <jonas.maebe@elis.ugent.be> | 2013-12-08 22:48:28 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2014-08-17 18:56:35 +0200 |
commit | 9f01a8acb3a6faf116278beebc1f376319f5cfe5 (patch) | |
tree | 810f6121eba44690d945f57daee44219bc3df49f /crypto/x509v3 | |
parent | 259ac68aeb9261a96071677e9c164980f654d8de (diff) |
process_pci_value: free (*policy)->data before setting to NULL after failed realloc
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/x509v3')
-rw-r--r-- | crypto/x509v3/v3_pci.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c index 0dcfa004fe..438cdfe003 100644 --- a/crypto/x509v3/v3_pci.c +++ b/crypto/x509v3/v3_pci.c @@ -149,6 +149,7 @@ static int process_pci_value(CONF_VALUE *val, { OPENSSL_free(tmp_data2); /* realloc failure implies the original data space is b0rked too! */ + OPENSSL_free((*policy)->data); (*policy)->data = NULL; (*policy)->length = 0; X509V3err(X509V3_F_PROCESS_PCI_VALUE,ERR_R_MALLOC_FAILURE); @@ -177,7 +178,15 @@ static int process_pci_value(CONF_VALUE *val, (*policy)->length + n + 1); if (!tmp_data) - break; + { + OPENSSL_free((*policy)->data); + (*policy)->data = NULL; + (*policy)->length = 0; + X509V3err(X509V3_F_PROCESS_PCI_VALUE,ERR_R_MALLOC_FAILURE); + X509V3_conf_err(val); + BIO_free_all(b); + goto err; + } (*policy)->data = tmp_data; memcpy(&(*policy)->data[(*policy)->length], @@ -210,6 +219,7 @@ static int process_pci_value(CONF_VALUE *val, else { /* realloc failure implies the original data space is b0rked too! */ + OPENSSL_free((*policy)->data); (*policy)->data = NULL; (*policy)->length = 0; X509V3err(X509V3_F_PROCESS_PCI_VALUE,ERR_R_MALLOC_FAILURE); |