diff options
Diffstat (limited to 'iconv')
-rw-r--r-- | iconv/gconv_conf.c | 5 | ||||
-rw-r--r-- | iconv/gconv_db.c | 4 | ||||
-rw-r--r-- | iconv/gconv_dl.c | 12 |
3 files changed, 12 insertions, 9 deletions
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c index ece63354da..a0aae43138 100644 --- a/iconv/gconv_conf.c +++ b/iconv/gconv_conf.c @@ -206,8 +206,9 @@ add_alias (char *rp, void *modules) from, wp - from); new_alias->toname = new_alias->fromname + (to - from); - if (__tsearch (new_alias, &__gconv_alias_db, __gconv_alias_compare) - == NULL) + if (__tfind (new_alias, &__gconv_alias_db, __gconv_alias_compare) != NULL + || (__tsearch (new_alias, &__gconv_alias_db, __gconv_alias_compare) + == NULL)) /* Something went wrong, free this entry. */ free (new_alias); } diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index c007732736..70cdaffbe1 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -163,6 +163,10 @@ free_derivation (void *p) if (deriv->steps[cnt].end_fct) _CALL_DL_FCT (deriv->steps[cnt].end_fct, (&deriv->steps[cnt])); + /* Free the name strings. */ + free ((char *) deriv->steps[0].from_name); + free ((char *) deriv->steps[deriv->nsteps - 1].to_name); + free ((struct gconv_step *) deriv->steps); free (deriv); } diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c index 5650389c78..33f0efea90 100644 --- a/iconv/gconv_dl.c +++ b/iconv/gconv_dl.c @@ -254,17 +254,15 @@ __gconv_release_shlib (struct gconv_loaded_object *handle) /* We run this if we debug the memory allocation. */ static void -do_release_all (const void *nodep, VISIT value, int level) +do_release_all (void *nodep) { - struct gconv_loaded_object *obj = *(struct gconv_loaded_object **) nodep; - - if (value != preorder && value != leaf) - return; + struct gconv_loaded_object *obj = (struct gconv_loaded_object *) nodep; /* Unload the shared object. We don't use the trick to catch errors since in the case an error is signalled something is really wrong. */ - _dl_close (obj->handle); + if (obj->handle != NULL) + _dl_close (obj->handle); free (obj); } @@ -272,6 +270,6 @@ do_release_all (const void *nodep, VISIT value, int level) static void __attribute__ ((unused)) free_mem (void) { - __twalk (loaded, do_release_all); + __tdestroy (loaded, do_release_all); } text_set_element (__libc_subfreeres, free_mem); |