message-item: Fix reference counting in message_item_to_text_item().
[pspp] / src / output / pivot-table.c
index 3d76ea2afa93ce79f88667380ce789641280757b..ad95d71fdb04d1c7f6d3950be6145cb374105a2b 100644 (file)
@@ -148,7 +148,10 @@ default_look (const struct pivot_table_look *new)
     {
       char *error = pivot_table_look_read ("default.stt", &look);
       if (error)
-        look = pivot_table_look_ref (pivot_table_look_builtin_default ());
+        {
+          free (error);
+          look = pivot_table_look_ref (pivot_table_look_builtin_default ());
+        }
     }
   return look;
 }
@@ -175,10 +178,11 @@ pivot_table_look_read (const char *name, struct pivot_table_look **lookp)
   size_t n = 0;
   path[n++] = ".";
   const char *home = getenv ("HOME");
+  char *allocated = NULL;
   if (home != NULL)
-    path[n++] = xasprintf ("%s/.pspp/looks", home);
-  char *allocated;
-  path[n++] = relocate2 (PKGDATADIR "/looks", &allocated);
+    path[n++] = allocated = xasprintf ("%s/.pspp/looks", home);
+  char *allocated2;
+  path[n++] = relocate2 (PKGDATADIR "/looks", &allocated2);
   path[n++] = NULL;
 
   /* Search path. */
@@ -190,6 +194,7 @@ pivot_table_look_read (const char *name, struct pivot_table_look **lookp)
       free (name2);
     }
   free (allocated);
+  free (allocated2);
   if (!file)
     return xasprintf ("%s: not found", name);