--- libaitcfg/src/aitcfg.c 2012/04/04 13:11:49 1.5 +++ libaitcfg/src/aitcfg.c 2012/07/25 15:24:20 1.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcfg.c,v 1.5 2012/04/04 13:11:49 misho Exp $ +* $Id: aitcfg.c,v 1.7 2012/07/25 15:24:20 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -154,13 +154,13 @@ cfgLoadConfig(const char *cfgName, cfg_root_t * __rest } /* - * cfgUnloadConfig() - Unload config from memory and free resources + * cfgClearConfig() - Clear config and free resources * * @cfg = Config root * return: none */ void -cfgUnloadConfig(cfg_root_t * __restrict cfg) +cfgClearConfig(cfg_root_t * __restrict cfg) { struct tagCfg *av; @@ -174,11 +174,25 @@ cfgUnloadConfig(cfg_root_t * __restrict cfg) AIT_FREE_VAL(&av->cfg_val); AIT_FREE_VAL(&av->cfg_attr); AIT_FREE_VAL(&av->cfg_sec); - free(av); + io_free(av); } cfg->rbh_root = NULL; CFG_RC_UNLOCK(cfg); +} +/* + * cfgUnloadConfig() - Unload config from memory and destroy resources + * + * @cfg = Config root + * return: none + */ +void +cfgUnloadConfig(cfg_root_t * __restrict cfg) +{ + if (!cfg) + return; + + cfgClearConfig(cfg); pthread_mutex_destroy(&cfg->rc_mtx); }