pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I free cases generated by procedure??


From: Ben Pfaff
Subject: Re: How do I free cases generated by procedure??
Date: Sat, 14 Oct 2006 16:23:34 -0700
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> I notice that test/xforms/casefile also leaks a lot of memory.  I
> don't know if these problems are related or not.

Probably not.  I investigated the former first.  Here's the fix
that I checked in.  I will look at RANK leaks now.

--- casefile-test.c.~1.5.~      2006-10-07 19:23:41.000000000 -0700
+++ casefile-test.c     2006-10-14 16:20:25.000000000 -0700
@@ -232,14 +232,17 @@ test_casereader_clone (struct casereader
 
   /* Read a 3rd of the cases */
   for ( i = 0 ; i < case_cnt / 3 ; ++i ) 
-    casereader_read (reader1, &c1);
+    {
+      casereader_read (reader1, &c1);
+      case_destroy (&c1);
+    }
 
   clone = casereader_clone (reader1);
 
   /* Copy all the cases into a new file */
   while( casereader_read (reader1, &c1))
     { 
-      casefile_append (newfile, &c1);
+      casefile_append_xfer (newfile, &c1);
       cases ++;
     }
 
@@ -254,13 +257,19 @@ test_casereader_clone (struct casereader
       cases --;
 
       if ( ! casereader_read_xfer (newreader, &c2) ) 
-       break;
+        {
+          case_destroy (&c1);
+          break; 
+        }
       
       v1 = case_data_all (&c1) ;
       v2 = case_data_all (&c2) ;
 
       if ( 0 != memcmp (v1, v2, value_cnt * MAX_SHORT_STRING))
        fail_test ("Cloned reader read different value at case %ld", cases);
+
+      case_destroy (&c1);
+      case_destroy (&c2);
     }
 
   if ( cases > 0 ) 

-- 
"The fact is, technical people are better off not looking at patents. If
 you don't know what they cover and where they are, you won't be knowingly
 infringing on them. If somebody sues you, you change the algorithm or you
 just hire a hit-man to whack the stupid git." --Linus Torvalds




reply via email to

[Prev in Thread] Current Thread [Next in Thread]