From 67adf64d9367f8b43ef725d7f0c03895a5b6460b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 21 Jun 2009 21:11:25 -0700 Subject: [PATCH] crosstabs: Fix free of bad pointer and use-after-free error in cleanup. In free_proc, 'pt' points within an array that is dynamically allocated, not to a data structure that is dynamically allocated, so we must not try to free it on each iteration. Instead, free the dynamic array itself (proc->pivots) only once. --- src/language/stats/crosstabs.q | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index 76cae1b3..1d35e14e 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -234,8 +234,8 @@ free_proc (struct crosstabs_proc *proc) The rest of the data was allocated and destroyed at a lower level already. */ - free (pt); } + free (proc->pivots); } static int internal_cmd_crosstabs (struct lexer *lexer, struct dataset *ds, -- 2.30.2