mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
check for nul pointer when destroying zone
This commit is contained in:
parent
746f2a2a1a
commit
cc97172bdd
2 changed files with 19 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
* Source/Additions/NSNumber+GNUstepBase.m:
|
||||
* Source/GSValue.m:
|
||||
* Source/NSZone.m:
|
||||
* Tools/gdomap.c:
|
||||
Fix various small issues picked by by automated checker.
|
||||
|
||||
|
|
|
@ -497,18 +497,27 @@ static NSZone *zone_list = 0;
|
|||
static inline void
|
||||
destroy_zone(NSZone* zone)
|
||||
{
|
||||
if (zone_list == zone)
|
||||
zone_list = zone->next;
|
||||
else
|
||||
if (zone)
|
||||
{
|
||||
NSZone *ptr = zone_list;
|
||||
if (zone_list == zone)
|
||||
{
|
||||
zone_list = zone->next;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSZone *ptr = zone_list;
|
||||
|
||||
while (ptr->next != zone)
|
||||
ptr = ptr->next;
|
||||
if (ptr)
|
||||
ptr->next = zone->next;
|
||||
while (ptr != NULL && ptr->next != zone)
|
||||
{
|
||||
ptr = ptr->next;
|
||||
}
|
||||
if (ptr)
|
||||
{
|
||||
ptr->next = zone->next;
|
||||
}
|
||||
}
|
||||
free((void*)zone);
|
||||
}
|
||||
free((void*)zone);
|
||||
}
|
||||
|
||||
/* Search the buffer to see if there is any memory chunks large enough
|
||||
|
|
Loading…
Reference in a new issue