diff --git a/ChangeLog b/ChangeLog index 12405ecba..80c3cd70d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2007-03-12 Richard Frith-Macdonald * NSTimeZones/NSTimeZones.tar: regenerated. + * Source/GSString.m: getCString_c() Fix error freeing unallocated + memory when converting a zero length constant string to external + cstring representation. 2007-03-09 Nicola Pero diff --git a/Source/Additions/GSCategories.m b/Source/Additions/GSCategories.m index c3d4f17f1..016e1b4f7 100644 --- a/Source/Additions/GSCategories.m +++ b/Source/Additions/GSCategories.m @@ -24,7 +24,7 @@ */ #include "config.h" #include -#include +#include "Foundation/Foundation.h" #include "GNUstepBase/GSCategories.h" #include "GNUstepBase/GSLock.h" #include "GSPrivate.h" diff --git a/Source/GSString.m b/Source/GSString.m index 75ce6b819..1afb07543 100644 --- a/Source/GSString.m +++ b/Source/GSString.m @@ -1624,7 +1624,10 @@ getCString_c(GSStr self, char *buffer, unsigned int maxLength, o._contents.c = self->_contents.c; GSStrWiden((GSStr)&o); getCString_u((GSStr)&o, buffer, maxLength, aRange, leftoverRange); - NSZoneFree(o._zone, o._contents.u); + if (o._flags.free == 1) + { + NSZoneFree(o._zone, o._contents.u); + } return; }