Fix minor memory management bug

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24853 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-03-12 16:47:42 +00:00
parent c4dbb7a39a
commit 235009b56b
3 changed files with 8 additions and 2 deletions

View file

@ -1,6 +1,9 @@
2007-03-12 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <nicola.pero@meta-innovation.com>

View file

@ -24,7 +24,7 @@
*/
#include "config.h"
#include <string.h>
#include <Foundation/Foundation.h>
#include "Foundation/Foundation.h"
#include "GNUstepBase/GSCategories.h"
#include "GNUstepBase/GSLock.h"
#include "GSPrivate.h"

View file

@ -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;
}