aboutsummaryrefslogtreecommitdiff
path: root/iconv/gconv_db.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-09-07 14:14:08 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-09-07 14:14:08 -0700
commitde2139a9f25d8f7fb76f260fe7cc86ffd736a5d9 (patch)
tree409489d11b7de23dbee2553f18e89056764071ef /iconv/gconv_db.c
parent5ca78dd02444d7a19d676d5c6aca9e0837f1b791 (diff)
downloadglibc-de2139a9f25d8f7fb76f260fe7cc86ffd736a5d9.zip
glibc-de2139a9f25d8f7fb76f260fe7cc86ffd736a5d9.tar.gz
glibc-de2139a9f25d8f7fb76f260fe7cc86ffd736a5d9.tar.bz2
Check if deriv->steps is NULL before freeing it
Diffstat (limited to 'iconv/gconv_db.c')
-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 a081205..5bc7ff8 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);
}