mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
attempt fix for bug #26843
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28360 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
940c602e67
commit
6215b5cae8
2 changed files with 21 additions and 24 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2009-06-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/Additions/Unicode.m: Fix incorrect attempt to free memory
|
||||||
|
we shouldn't. Should fix bug #26843
|
||||||
|
|
||||||
2009-06-16 Richard Frith-Macdonald <rfm@gnu.org>
|
2009-06-16 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/win32/NSMessagePort.m: Don't use NSLog() to report error
|
* Source/win32/NSMessagePort.m: Don't use NSLog() to report error
|
||||||
|
|
|
@ -820,8 +820,7 @@ else \
|
||||||
} \
|
} \
|
||||||
if (ptr == 0) \
|
if (ptr == 0) \
|
||||||
{ \
|
{ \
|
||||||
result = NO; /* Not enough memory */ \
|
return NO; /* Not enough memory */ \
|
||||||
break; \
|
|
||||||
} \
|
} \
|
||||||
bsize = grow / sizeof(unichar); \
|
bsize = grow / sizeof(unichar); \
|
||||||
}
|
}
|
||||||
|
@ -875,8 +874,7 @@ else \
|
||||||
} \
|
} \
|
||||||
if (ptr == 0) \
|
if (ptr == 0) \
|
||||||
{ \
|
{ \
|
||||||
result = NO; /* Not enough memory */ \
|
return NO; /* Not enough memory */ \
|
||||||
break; \
|
|
||||||
} \
|
} \
|
||||||
bsize = grow / sizeof(unichar); \
|
bsize = grow / sizeof(unichar); \
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1116,7 @@ GSToUnicode(unichar **dst, unsigned int *size, const unsigned char *src,
|
||||||
memcpy(tmp, ptr, bsize * sizeof(unichar));
|
memcpy(tmp, ptr, bsize * sizeof(unichar));
|
||||||
}
|
}
|
||||||
#if !GS_WITH_GC
|
#if !GS_WITH_GC
|
||||||
if (ptr != buf)
|
if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
@ -1126,8 +1124,7 @@ GSToUnicode(unichar **dst, unsigned int *size, const unsigned char *src,
|
||||||
ptr = tmp;
|
ptr = tmp;
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
{
|
{
|
||||||
result = NO; /* Not enough memory */
|
return NO; /* Not enough memory */
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
bsize = grow / sizeof(unichar);
|
bsize = grow / sizeof(unichar);
|
||||||
}
|
}
|
||||||
|
@ -1183,7 +1180,7 @@ GSToUnicode(unichar **dst, unsigned int *size, const unsigned char *src,
|
||||||
memcpy(tmp, ptr, bsize * sizeof(unichar));
|
memcpy(tmp, ptr, bsize * sizeof(unichar));
|
||||||
}
|
}
|
||||||
#if !GS_WITH_GC
|
#if !GS_WITH_GC
|
||||||
if (ptr != buf)
|
if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
@ -1191,8 +1188,7 @@ GSToUnicode(unichar **dst, unsigned int *size, const unsigned char *src,
|
||||||
ptr = tmp;
|
ptr = tmp;
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
{
|
{
|
||||||
result = NO; /* Not enough memory */
|
return NO; /* Not enough memory */
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
bsize = grow / sizeof(unichar);
|
bsize = grow / sizeof(unichar);
|
||||||
}
|
}
|
||||||
|
@ -1273,7 +1269,7 @@ tables:
|
||||||
memcpy(tmp, ptr, bsize * sizeof(unichar));
|
memcpy(tmp, ptr, bsize * sizeof(unichar));
|
||||||
}
|
}
|
||||||
#if !GS_WITH_GC
|
#if !GS_WITH_GC
|
||||||
if (ptr != buf)
|
if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
@ -1281,8 +1277,7 @@ tables:
|
||||||
ptr = tmp;
|
ptr = tmp;
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
{
|
{
|
||||||
result = NO; /* Not enough memory */
|
return NO; /* Not enough memory */
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
bsize = grow / sizeof(unichar);
|
bsize = grow / sizeof(unichar);
|
||||||
}
|
}
|
||||||
|
@ -1442,7 +1437,7 @@ done:
|
||||||
#else
|
#else
|
||||||
r = GSAutoreleasedBuffer(bytes);
|
r = GSAutoreleasedBuffer(bytes);
|
||||||
memcpy(r, ptr, bytes);
|
memcpy(r, ptr, bytes);
|
||||||
if (ptr != buf && (dst == 0 || ptr != *dst))
|
if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
@ -1494,7 +1489,7 @@ done:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !GS_WITH_GC
|
#if !GS_WITH_GC
|
||||||
else if (ptr != buf && dst != 0 && ptr != *dst)
|
else if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
@ -1557,8 +1552,7 @@ else \
|
||||||
} \
|
} \
|
||||||
if (ptr == 0) \
|
if (ptr == 0) \
|
||||||
{ \
|
{ \
|
||||||
result = NO; /* Not enough memory */ \
|
return NO; /* Not enough memory */ \
|
||||||
break; \
|
|
||||||
} \
|
} \
|
||||||
bsize = grow; \
|
bsize = grow; \
|
||||||
}
|
}
|
||||||
|
@ -1611,8 +1605,7 @@ else \
|
||||||
} \
|
} \
|
||||||
if (ptr == 0) \
|
if (ptr == 0) \
|
||||||
{ \
|
{ \
|
||||||
result = NO; /* Not enough memory */ \
|
return NO; /* Not enough memory */ \
|
||||||
break; \
|
|
||||||
} \
|
} \
|
||||||
bsize = grow; \
|
bsize = grow; \
|
||||||
}
|
}
|
||||||
|
@ -2073,7 +2066,7 @@ bases:
|
||||||
tmp = NSAllocateCollectable(slen, 0);
|
tmp = NSAllocateCollectable(slen, 0);
|
||||||
#else
|
#else
|
||||||
tmp = NSZoneMalloc(zone, slen);
|
tmp = NSZoneMalloc(zone, slen);
|
||||||
if (ptr != buf)
|
if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
@ -2081,8 +2074,7 @@ bases:
|
||||||
ptr = tmp;
|
ptr = tmp;
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
{
|
{
|
||||||
result = NO; /* Not enough memory */
|
return NO; /* Not enough memory */
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
bsize = slen;
|
bsize = slen;
|
||||||
}
|
}
|
||||||
|
@ -2442,7 +2434,7 @@ iconv_start:
|
||||||
#else
|
#else
|
||||||
r = GSAutoreleasedBuffer(bytes);
|
r = GSAutoreleasedBuffer(bytes);
|
||||||
memcpy(r, ptr, bytes);
|
memcpy(r, ptr, bytes);
|
||||||
if (ptr != buf && (dst == 0 || ptr != *dst))
|
if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
@ -2494,7 +2486,7 @@ iconv_start:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if !GS_WITH_GC
|
#if !GS_WITH_GC
|
||||||
else if (ptr != buf && dst != 0 && ptr != *dst)
|
else if (ptr != buf && ptr != *dst)
|
||||||
{
|
{
|
||||||
NSZoneFree(zone, ptr);
|
NSZoneFree(zone, ptr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue