Fix memory leaks.
[pspp-builds.git] / src / tab.c
index 118a77cd68df7f26b84af4c32b55a836c3d9a250..8afb8f0be0e3793d85675de5dc6fd5d87867e6b2 100644 (file)
--- a/src/tab.c
+++ b/src/tab.c
 #include <config.h>
 #include "tab.h"
 #include <ctype.h>
-#include <assert.h>
 #include <stdarg.h>
 #include <limits.h>
 #include <stdlib.h>
+#include "error.h"
 #include "alloc.h"
 #include "command.h"
 #include "format.h"
 \f
 struct som_table_class tab_table_class;
 
-#if DEBUGGING
-#define DEFFIRST(NAME, LABEL) LABEL,
-#define DEFTAB(NAME, LABEL) LABEL,
-/*
-static const char *tab_names[] =
-  {
-#include "tab.def"
-  };
-*/
-#undef DEFFIRST
-#undef DEFTAB
-#endif
-
 /* Creates a table with NC columns and NR rows.  If REALLOCABLE is
    nonzero then the table's size can be increased later; otherwise,
    its size can only be reduced. */
@@ -433,7 +420,8 @@ text_format (struct tab_table *table, int opt, const char *text, va_list args,
   else
     len = strlen (text);
 
-  ls_create_buffer (table->container, s, text, len);
+  ls_create_buffer (s, text, len);
+  pool_register (table->container, free, s->string);
   
   if (opt & TAT_PRINTF)
     local_free (text);
@@ -1162,7 +1150,7 @@ tabi_title (int x, int y)
   cp = stpcpy (cp, ".  ");
   if (!ls_empty_p (&t->title))
     {
-      memcpy (cp, ls_value (&t->title), ls_length (&t->title));
+      memcpy (cp, ls_c_str (&t->title), ls_length (&t->title));
       cp += ls_length (&t->title);
     }
   *cp = 0;
@@ -1337,7 +1325,7 @@ render_strip (int x, int y, int r, int c1, int c2, int r1 UNUSED, int r2)
                    }
                } else {
                  struct tab_joined_cell *j =
-                   (struct tab_joined_cell *) ls_value (&t->cc[index]);
+                   (struct tab_joined_cell *) ls_c_str (&t->cc[index]);
 
                  if (j->hit != tab_hit)
                    {