From aed0859ffa05ab75256cba1c1592efc1e61a1b6e Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Fri, 2 Sep 2016 18:22:35 +0200 Subject: [PATCH] Fix double free on error condition Change-Id: I41224563de4d6176e60a5f4c893560e3dcf96b86 Reported-by: Krzysztof Kozlowski Signed-off-by: Krzysztof Opasiak --- libthor/thor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libthor/thor.c b/libthor/thor.c index a670f4d..4ab42a2 100644 --- a/libthor/thor.c +++ b/libthor/thor.c @@ -426,8 +426,11 @@ static int t_thor_send_raw_data(thor_device_handle *th, cancel_chunks: for (j = 0; j < i; ++j) t_thor_cancel_chunk(chunk + j); - if (i) + if (i) { + transfer_data.completed = 0; t_thor_handle_events(&transfer_data); + } + i = ARRAY_SIZE(chunk); cleanup_chunks: for (j = 0; j < i; ++j) -- 2.34.1