This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Check if deriv->steps is NULL before freeing it


With --disable-shared, deriv->steps may be NULL.  This patch checks it.
OK to install?

Thanks.


H.J.
---
	* iconv/gconv_db.c (free_derivation): Check if deriv->steps
	is NULL.

diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index a081205..703c9e3 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)
+    {
+      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);
 }
 
-- 
1.7.11.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]