(parse_aggregate_functions) If dict_create_var() fails, don't
[pspp-builds.git] / src / aggregate.c
index 47f34dcab440fc6fe81a573d512eb91398d8a8cf..fa89cc4934c45a8dbe28254ae123c61634921637 100644 (file)
@@ -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;
              }