hivex: Fix allocations that may move C heap buffer.
authorRichard Jones <rjones@redhat.com>
Tue, 23 Feb 2010 19:08:41 +0000 (19:08 +0000)
committerRichard Jones <rjones@redhat.com>
Tue, 23 Feb 2010 19:17:40 +0000 (19:17 +0000)
When heavily extending existing hive files, the malloc-allocated
in-memory copy of the hive may be moved when we reallocate it
(to increase its size).  However we didn't adjust existing
pointers to cope with this, so sometimes you could get a segfault.

This patch fixes the issue by adjusting pointers as necessary
after calling (directly or indirectly) to the allocate_block
function.

With this patch I was able to allocate 10,000's of blocks in
a deeply nested hive structure without any problems being reported
by valgrind.


No differences found