summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_db.c6
-rw-r--r--iconv/gconv_dl.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index 2c66249cc5..d5d075df88 100644
--- a/iconv/gconv_db.c
+++ b/iconv/gconv_db.c
@@ -239,6 +239,7 @@ gen_steps (struct derivation_step *best, const char *toset,
 	    }
 	  free (result);
 	  *nsteps = 0;
+	  *handle = NULL;
 	  status = GCONV_NOCONV;
 	}
       else
@@ -247,6 +248,11 @@ gen_steps (struct derivation_step *best, const char *toset,
 	  status = GCONV_OK;
 	}
     }
+  else
+    {
+      *nsteps = 0;
+      *handle = NULL;
+    }
 
   return status;
 }
diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c
index 8375040d84..e0471b0de6 100644
--- a/iconv/gconv_dl.c
+++ b/iconv/gconv_dl.c
@@ -129,6 +129,7 @@ internal_function
 __gconv_find_shlib (const char *name)
 {
   struct gconv_loaded_object *found;
+  void *keyp;
 
   /* Search the tree of shared objects previously requested.  Data in
      the tree are `loaded_object' structures, whose first member is a
@@ -139,8 +140,8 @@ __gconv_find_shlib (const char *name)
      enough to a pointer to our structure to use as a lookup key that
      will be passed to `known_compare' (above).  */
 
-  found = __tfind (&name, &loaded, known_compare);
-  if (found == NULL)
+  keyp = __tfind (&name, &loaded, known_compare);
+  if (keyp == NULL)
     {
       /* This name was not known before.  */
       found = malloc (sizeof (struct gconv_loaded_object));
@@ -159,6 +160,8 @@ __gconv_find_shlib (const char *name)
 	    }
 	}
     }
+  else
+    found = *(struct gconv_loaded_object **) keyp;
 
   /* Try to load the shared object if the usage count is 0.  This
      implies that if the shared object is not loadable, the handle is