about summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
Diffstat (limited to 'iconv')
-rw-r--r--iconv/gconv_db.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index a081205106..5bc7ff8bd0 100644
--- a/iconv/gconv_db.c
+++ b/iconv/gconv_db.c
@@ -193,10 +193,13 @@ free_derivation (void *p)
       }
 
   /* Free the name strings.  */
-  free ((char *) deriv->steps[0].__from_name);
-  free ((char *) deriv->steps[deriv->nsteps - 1].__to_name);
+  if (deriv->steps != NULL)
+    {
+      free ((char *) deriv->steps[0].__from_name);
+      free ((char *) deriv->steps[deriv->nsteps - 1].__to_name);
+      free ((struct __gconv_step *) deriv->steps);
+    }
 
-  free ((struct __gconv_step *) deriv->steps);
   free (deriv);
 }