diff options
author | tb <> | 2025-03-07 11:01:12 +0000 |
---|---|---|
committer | tb <> | 2025-03-07 11:01:12 +0000 |
commit | 44ed550ca5e0b6e9358fa1dc3fe19cf4014eb338 (patch) | |
tree | 97d0831fb9ce715ded7d9d713a1ab1d3d4ccfab1 /src | |
parent | dd7cad4ac6e5632efe1e2fd3ed0e9e80e2405328 (diff) | |
download | openbsd-44ed550ca5e0b6e9358fa1dc3fe19cf4014eb338.tar.gz openbsd-44ed550ca5e0b6e9358fa1dc3fe19cf4014eb338.tar.bz2 openbsd-44ed550ca5e0b6e9358fa1dc3fe19cf4014eb338.zip |
_CONF_new_section: error check hash insertion
Don't leak v if its insertion into the hash failed and properly free it
instead.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/conf/conf_api.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c index 511f9d6470..5ed2a6332d 100644 --- a/src/lib/libcrypto/conf/conf_api.c +++ b/src/lib/libcrypto/conf/conf_api.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: conf_api.c,v 1.24 2025/03/07 10:57:29 tb Exp $ */ | 1 | /* $OpenBSD: conf_api.c,v 1.25 2025/03/07 11:01:12 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -259,11 +259,15 @@ _CONF_new_section(CONF *conf, const char *section) | |||
259 | 259 | ||
260 | vv = lh_CONF_VALUE_insert(conf->data, v); | 260 | vv = lh_CONF_VALUE_insert(conf->data, v); |
261 | OPENSSL_assert(vv == NULL); | 261 | OPENSSL_assert(vv == NULL); |
262 | if (lh_CONF_VALUE_error(conf->data)) | ||
263 | goto err; | ||
262 | 264 | ||
263 | return v; | 265 | return v; |
264 | 266 | ||
265 | err: | 267 | err: |
266 | sk_CONF_VALUE_free(sk); | 268 | sk_CONF_VALUE_free(sk); |
269 | if (v != NULL) | ||
270 | free(v->section); | ||
267 | free(v); | 271 | free(v); |
268 | 272 | ||
269 | return NULL; | 273 | return NULL; |