mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-01-26 13:29:45 +00:00
[all] general: fix possible memory leaks with realloc usage
This commit is contained in:
@@ -164,7 +164,14 @@ static int dl_iterate_phdr_callback(struct dl_phdr_info * info, size_t size, voi
|
||||
ttl += hdr.p_memsz;
|
||||
}
|
||||
|
||||
crash.ranges = realloc(crash.ranges, sizeof(*crash.ranges) * (crash.rangeCount + 1));
|
||||
void * tmp = realloc(crash.ranges,
|
||||
sizeof(*crash.ranges) * (crash.rangeCount + 1));
|
||||
if (!tmp)
|
||||
{
|
||||
DEBUG_ERROR("out of memory");
|
||||
return 1;
|
||||
}
|
||||
crash.ranges = tmp;
|
||||
crash.ranges[crash.rangeCount].start = info->dlpi_addr;
|
||||
crash.ranges[crash.rangeCount].end = info->dlpi_addr + ttl;
|
||||
++crash.rangeCount;
|
||||
|
||||
Reference in New Issue
Block a user