Fix two memory leaks in doit() and refine get_next_write()

Avoid two memory leaks in doit() which were unproblematic for flashrom
because flashrom terminates after finishing doit(). Rename oldcontents
to curconents in erase_and_write_block_helper(). Unify the code for
all granularities in get_next_write(). Return write length from
get_next_write() instead of filling it as referenced parameter.

Thanks to Michael Karcher for pointing out the first two issues. Thanks
to David Hendricks for pointing out the third issue and suggesting a way
to unify that code.

Corresponding to flashrom svn r1225.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
1 file changed