summaryrefslogtreecommitdiffstats
path: root/crypto/conf/conf_def.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-05-01 15:15:13 +0100
committerMatt Caswell <matt@openssl.org>2020-05-06 11:40:53 +0100
commit15dd075f708c58bbbbd18f98608fecfcb97f693a (patch)
tree44531bdc8b833412a09e63a5897e6ada961a4675 /crypto/conf/conf_def.c
parent6ed34b3eff68b79ce9fb00d84c95c950d8bc7bdd (diff)
Fix a memory leak in CONF .include handling
If OPENSSL_CONF_INCLUDE has been set then we may leak the "include" buffer. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11691)
Diffstat (limited to 'crypto/conf/conf_def.c')
-rw-r--r--crypto/conf/conf_def.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index 9dbda10edf..6efe291ac8 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -420,6 +420,7 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
OPENSSL_strlcpy(include_path, include_dir, newlen);
OPENSSL_strlcat(include_path, "/", newlen);
OPENSSL_strlcat(include_path, include, newlen);
+ OPENSSL_free(include);
} else {
include_path = include;
}
@@ -429,15 +430,11 @@ static int def_load_bio(CONF *conf, BIO *in, long *line)
next = process_include(include_path, &dirctx, &dirpath);
if (include_path != dirpath) {
/* dirpath will contain include in case of a directory */
- OPENSSL_free(include);
- if (include_path != include)
- OPENSSL_free(include_path);
+ OPENSSL_free(include_path);
}
#else
next = BIO_new_file(include_path, "r");
- OPENSSL_free(include);
- if (include_path != include)
- OPENSSL_free(include_path);
+ OPENSSL_free(include_path);
#endif
if (next != NULL) {