fix potential null pointer deref

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36840 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-07-05 20:47:41 +00:00
parent d65b9254dd
commit b71fde4e19

View file

@ -525,8 +525,11 @@ _GSDebugAllocationList(BOOL difference)
buf = NSZoneMalloc(NSDefaultMallocZone(), siz); buf = NSZoneMalloc(NSDefaultMallocZone(), siz);
} }
if (buf) if (0 == buf)
{ {
return "";
}
pos = 0; pos = 0;
for (i = 0; i < num_classes; i++) for (i = 0; i < num_classes; i++)
{ {
@ -545,7 +548,7 @@ _GSDebugAllocationList(BOOL difference)
pos += strlen(&buf[pos]); pos += strlen(&buf[pos]);
} }
} }
}
return buf; return buf;
} }
@ -612,8 +615,11 @@ _GSDebugAllocationListAll(void)
buf = NSZoneMalloc(NSDefaultMallocZone(), siz); buf = NSZoneMalloc(NSDefaultMallocZone(), siz);
} }
if (buf) if (0 == buf)
{ {
return "";
}
pos = 0; pos = 0;
for (i = 0; i < num_classes; i++) for (i = 0; i < num_classes; i++)
{ {
@ -626,7 +632,7 @@ _GSDebugAllocationListAll(void)
pos += strlen(&buf[pos]); pos += strlen(&buf[pos]);
} }
} }
}
return buf; return buf;
} }