summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2024-03-20 21:31:31 +0000
committertb <>2024-03-20 21:31:31 +0000
commitf1380ec05ac6100b94e238dc0bc83cc4946033f7 (patch)
tree28199d1f332789cd03cd3f205069ffa190aa5b8e /src
parent071e47db9a38ff1fbcef14ebecd8a54fb825f6e5 (diff)
downloadopenbsd-f1380ec05ac6100b94e238dc0bc83cc4946033f7.tar.gz
openbsd-f1380ec05ac6100b94e238dc0bc83cc4946033f7.tar.bz2
openbsd-f1380ec05ac6100b94e238dc0bc83cc4946033f7.zip
Implement imodule_free() and call it from module_finish()
ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/conf/conf_mod.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c
index f1a88c92b3..f1522b9518 100644
--- a/src/lib/libcrypto/conf/conf_mod.c
+++ b/src/lib/libcrypto/conf/conf_mod.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: conf_mod.c,v 1.29 2024/03/20 21:21:03 tb Exp $ */ 1/* $OpenBSD: conf_mod.c,v 1.30 2024/03/20 21:31:31 tb Exp $ */
2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL 2/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -97,6 +97,7 @@ static STACK_OF(CONF_MODULE) *supported_modules = NULL;
97static STACK_OF(CONF_IMODULE) *initialized_modules = NULL; 97static STACK_OF(CONF_IMODULE) *initialized_modules = NULL;
98 98
99static void module_free(CONF_MODULE *md); 99static void module_free(CONF_MODULE *md);
100static void imodule_free(CONF_IMODULE *imod);
100static void module_finish(CONF_IMODULE *imod); 101static void module_finish(CONF_IMODULE *imod);
101static int module_run(const CONF *cnf, char *name, char *value, 102static int module_run(const CONF *cnf, char *name, char *value,
102 unsigned long flags); 103 unsigned long flags);
@@ -371,6 +372,17 @@ module_free(CONF_MODULE *md)
371 free(md); 372 free(md);
372} 373}
373 374
375static void
376imodule_free(CONF_IMODULE *imod)
377{
378 if (imod == NULL)
379 return;
380
381 free(imod->name);
382 free(imod->value);
383 free(imod);
384}
385
374/* finish and free up all modules instances */ 386/* finish and free up all modules instances */
375 387
376void 388void
@@ -394,9 +406,8 @@ module_finish(CONF_IMODULE *imod)
394 if (imod->pmod->finish) 406 if (imod->pmod->finish)
395 imod->pmod->finish(imod); 407 imod->pmod->finish(imod);
396 imod->pmod->links--; 408 imod->pmod->links--;
397 free(imod->name); 409
398 free(imod->value); 410 imodule_free(imod);
399 free(imod);
400} 411}
401 412
402/* Add a static module to OpenSSL */ 413/* Add a static module to OpenSSL */