Don't leak memory when handling %s, %S, %@ with strings longer than 8191 characters.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16931 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2003-06-16 11:38:49 +00:00
parent 6341c223a6
commit ad9e0c2bf3
2 changed files with 21 additions and 14 deletions

View file

@ -1,3 +1,8 @@
2003-06-16 13:36 Alexander Malmberg <alexander@malmberg.org>
* Source/GSFormat.m (GSFormat()): Free malloc memory in all cases
after handling %s, %S, %@ with strings longer than 8192 characters.
2003-06-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSAutoreleasePool.m: Documented.

View file

@ -1787,14 +1787,15 @@ NSDictionary *locale)
if ((width -= len) <= 0)
{
outstring (string, len);
break;
}
if (!left)
PAD (' ');
outstring (string, len);
if (left)
PAD (' ');
else
{
if (!left)
PAD (' ');
outstring (string, len);
if (left)
PAD (' ');
}
if (string_malloced)
NSZoneFree(s->z, string);
}
@ -1842,14 +1843,15 @@ NSDictionary *locale)
if ((width -= len) < 0)
{
outstring (string, len);
break;
}
if (!left)
PAD (' ');
outstring (string, len);
if (left)
PAD (' ');
else
{
if (!left)
PAD (' ');
outstring (string, len);
if (left)
PAD (' ');
}
if (string_malloced)
NSZoneFree(s->z, string);
}