data_out function to dynamically allocate return value.
[pspp-builds.git] / src / data / variable.c
index 8d85b518a5f8325dbef9c257e8af20d2ca21ab3a..a60adcafcd8d25422f7be32d8f870059c2c028f3 100644 (file)
@@ -592,8 +592,9 @@ var_append_value_name (const struct variable *v, const union value *value,
   const char *name = var_lookup_value_label (v, value);
   if (name == NULL)
     {
-      char *s = ds_put_uninit (str, v->print.w);
-      data_out (value, &v->print, s);
+      char *s = data_out (value, &v->print);
+      ds_put_cstr (str, s);
+      free (s);
     }
   else
     ds_put_cstr (str, name);