data_out function to dynamically allocate return value.
[pspp-builds.git] / src / language / expressions / operations.def
index 2d31bd47182dcb158d9f9c50e644fb03bb7b07bf..db71d2770339db273fa5114fe456afb83f106411 100644 (file)
@@ -582,11 +582,15 @@ absorb_miss string function STRING (x, no_format f)
 {
   union value v;
   struct substring dst;
+  char *s;
 
   v.f = x;
-  dst = alloc_string (e, f->w);
+
   assert (!fmt_is_string (f->type));
-  data_out (&v, f, dst.string);
+  s = data_out (&v, f);
+  dst = alloc_string (e, strlen (s));
+  strcpy (dst.string, s);
+  free (s);
   return dst;
 }