Fix malloc/realloc replacement, bug#151.

Signed-off-by: Will Estes <westes575@gmail.com>