From 30a05703cc3f2ab8391601178f8e26366f9af8dd Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 2 Oct 2013 21:54:23 +0200 Subject: [PATCH] gpu.c: group_writes: fix error handling join_groups_and_free has freed one of the groups and we need to mark it as having been freed before checking for errors, which could otherwise result in the group getting freed again. Signed-off-by: Sven Verdoolaege --- gpu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gpu.c b/gpu.c index 5a72df5..5e369a4 100644 --- a/gpu.c +++ b/gpu.c @@ -2881,13 +2881,14 @@ static int group_writes(struct gpu_gen *gen, continue; groups[i] = join_groups_and_free(groups[i], groups[j]); - if (compute_bounds && - compute_group_bounds(gen, groups[i]) < 0) - return -1; if (j != n - 1) groups[j] = groups[n - 1]; groups[n - 1] = NULL; n--; + + if (compute_bounds && + compute_group_bounds(gen, groups[i]) < 0) + return -1; } } -- 2.11.4.GIT