state: Fix "pack" returning freed data for DTB backend
`state_backend_format_dtb_pack()` passes a buffer containing state
packed in flattened DTB format back to its caller via its `buf`
parameter.  It then frees the buffer before returning.  This means the
caller (`state_save()`) will be working on freed buffer contents before
freeing the buffer a second time itself.  Fix it by removing the
spurious call to `free()`.

This should fix a bug reported by Norbert Wiedmann in
<http://lists.infradead.org/pipermail/barebox/2017-April/029980.html>.

Cc: Norbert Wiedmann <info@n-wiedmann.de>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent c0befa7 commit ec01cbce2165deb3d814f0c031043fa999632eaa
@Ian Abbott Ian Abbott authored on 21 Apr 2017
Sascha Hauer committed on 21 Apr 2017
Showing 1 changed file
View
common/state/backend_format_dtb.c