From ec01cbce2165deb3d814f0c031043fa999632eaa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 21 Apr 2017 10:53:25 +0100 Subject: 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 . Cc: Norbert Wiedmann Signed-off-by: Ian Abbott Signed-off-by: Sascha Hauer --- common/state/backend_format_dtb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/state/backend_format_dtb.c b/common/state/backend_format_dtb.c index 55fa1fc597..e88cda499b 100644 --- a/common/state/backend_format_dtb.c +++ b/common/state/backend_format_dtb.c @@ -120,8 +120,6 @@ static int state_backend_format_dtb_pack(struct state_backend_format *format, of_delete_node(fdtb->root); fdtb->root = root; - free(fdt); - return 0; } -- cgit v1.2.3