From 72964897ce92525ea62e1e1b1b7df24b6c6125dd Mon Sep 17 00:00:00 2001 From: Petri Latvala Date: Wed, 16 Jan 2019 13:20:41 +0200 Subject: benchmarks/gem_userptr_benchmark: Correctly free memory if (p) free(p) does a useless check, free(NULL) is a valid call. Also assign NULL so we don't end up double-freeing memory if anyone reorders nr_bos to have a 0 after other values. Signed-off-by: Petri Latvala Cc: Tvrtko Ursulin Reviewed-by: Tvrtko Ursulin --- benchmarks/gem_userptr_benchmark.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'benchmarks') diff --git a/benchmarks/gem_userptr_benchmark.c b/benchmarks/gem_userptr_benchmark.c index f7716dfa..bef2ccc4 100644 --- a/benchmarks/gem_userptr_benchmark.c +++ b/benchmarks/gem_userptr_benchmark.c @@ -355,8 +355,9 @@ static void test_impact_overlap(int fd, const char *prefix) for (i = 0; i < nr_bos[subtest]; i++) gem_close(fd, handles[i]); - if (block) - free(block); + + free(block); + block = NULL; } } -- cgit v1.2.3