tests/bugs/case-map.sh leaks memory.

The attached patch fixes the leak, but causes
tests/command/n_of_cases.sh to fail.

I haven't managed to work out what its problem is. Maybe somebody can
tell me --- if not I'll have another look at it next week.

J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Index: src/data/casereader.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/casereader.c,v
retrieving revision 1.6
diff -b -w -U 3 -r1.6 casereader.c
--- src/data/casereader.c       13 Aug 2007 00:43:48 -0000      1.6
+++ src/data/casereader.c       28 Aug 2007 06:18:45 -0000
@@ -235,8 +235,8 @@
     {
       casenumber n_cases = 0;
       struct ccase c;
-
       struct casereader *clone = casereader_clone (reader);
+      case_nullify (&c);
 
       for (; casereader_read (clone, &c); case_destroy (&c))
         n_cases++;
@@ -261,6 +261,7 @@
 casereader_transfer (struct casereader *reader, struct casewriter *writer)
 {
   struct ccase c;
+  case_nullify (&c);
 
   taint_propagate (casereader_get_taint (reader),
                    casewriter_get_taint (writer));
@@ -559,6 +560,8 @@
   while (casewindow_get_case_cnt (b->window) < case_cnt)
     {
       struct ccase tmp;
+      case_nullify (&tmp);
+
       if (!casereader_read (b->subreader, &tmp))
         return false;
       casewindow_push_head (b->window, &tmp);
Index: src/language/data-io/inpt-pgm.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/inpt-pgm.c,v
retrieving revision 1.28
diff -b -w -U 3 -r1.28 inpt-pgm.c
--- src/language/data-io/inpt-pgm.c     7 Jul 2007 06:14:12 -0000       1.28
+++ src/language/data-io/inpt-pgm.c     28 Aug 2007 06:18:45 -0000
@@ -188,6 +188,7 @@
 {
   struct input_program_pgm *inp = inp_;
 
+  if ( case_is_null (c) )
   case_create (c, inp->value_cnt);
 
   do
Index: src/language/data-io/list.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/list.q,v
retrieving revision 1.28
diff -b -w -U 3 -r1.28 list.q
--- src/language/data-io/list.q 7 Jul 2007 06:14:13 -0000       1.28
+++ src/language/data-io/list.q 28 Aug 2007 06:18:46 -0000
@@ -235,6 +235,7 @@
        casereader_destroy (group))
     {
       struct ccase c;
+      case_nullify (&c);
 
       write_all_headers (group, ds);
       for (; casereader_read (group, &c); case_destroy (&c))
@@ -265,6 +266,7 @@
   struct outp_driver *d;
   struct ccase c;
 
+  case_nullify (&c);
   if (!casereader_peek (input, 0, &c))
     return;
   output_split_file_values (ds, &c);

Attachment: signature.asc
Description: Digital signature

_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to