Fix memory deallocation bug
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 21 Oct 2010 20:01:34 +0000 (22:01 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 21 Oct 2010 20:01:34 +0000 (22:01 +0200)
src/language/stats/runs.c

index 450edbf437a4927302e633ce3a279b89b90b91d2..d27cbf402387fe80e57358ee8ed3af865121eedb 100644 (file)
@@ -186,12 +186,15 @@ runs_execute (const struct dataset *ds,
            subcase_init_var (&sc, var, SC_ASCEND);
            writer = sort_create_writer (&sc, casereader_get_proto (reader));
 
-           for (; (c = casereader_read (reader)); case_unref (c))
+           for (; (c = casereader_read (reader)); )
              {
                const union value *val = case_data (c, var);
                const double w = weight ? case_data (c, weight)->f: 1.0;
                if ( var_is_value_missing (var, val, exclude))
-                 continue;
+                 {
+                   case_unref (c);
+                   continue;
+                 }
 
                cc += w;
                casewriter_write (writer, c);