From: Ben Pfaff Date: Tue, 5 Apr 2005 05:29:58 +0000 (+0000) Subject: (parse_aggregate_functions) If dict_create_var() fails, don't X-Git-Tag: v0.4.0~124 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7cc8b259f0fe963aa30d4e64f7d39551ded1454;p=pspp-builds.git (parse_aggregate_functions) If dict_create_var() fails, don't dereference the resulting null pointer (PR 12427). Also, fix double free error. --- diff --git a/src/ChangeLog b/src/ChangeLog index 8eb8d126..68d0d089 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +Mon Apr 4 22:27:34 2005 Ben Pfaff + + * aggregate.c: (parse_aggregate_functions) If dict_create_var() + fails, don't dereference the resulting null pointer (PR 12427). + Also, fix double free error. + Sat Mar 19 23:06:02 2005 Ben Pfaff * aggregate.c: (parse_aggregate_functions) Fix N_NO_VARS format. diff --git a/src/aggregate.c b/src/aggregate.c index 47f34dca..fa89cc49 100644 --- a/src/aggregate.c +++ b/src/aggregate.c @@ -545,16 +545,15 @@ parse_aggregate_functions (struct agr_proc *agr) || function->alpha_type == NUMERIC) { destvar = dict_create_var (agr->dict, dest[i], 0); - - if ((func_index == N || func_index == NMISS) - && dict_get_weight (default_dict) != NULL) - destvar->print = destvar->write = f8_2; - else - destvar->print = destvar->write = function->format; + if (destvar != NULL) + { + if ((func_index == N || func_index == NMISS) + && dict_get_weight (default_dict) != NULL) + destvar->print = destvar->write = f8_2; + else + destvar->print = destvar->write = function->format; + } } - else - destvar = dict_create_var (agr->dict, dest[i], - v->src->width); } else { v->src = NULL; destvar = dict_create_var (agr->dict, dest[i], 0); @@ -572,7 +571,6 @@ parse_aggregate_functions (struct agr_proc *agr) "the aggregate variables and the break " "variables."), dest[i]); - free (dest[i]); goto error; }