Fixed some memory leaks
[pspp] / src / data / ods-reader.c
index fe9b90049b262f98dcb6de7931ef7e8217a0fcf0..cb16dbc6944187ea0312fe82f135c85623ea02df 100644 (file)
@@ -523,6 +523,8 @@ init_reader (struct ods_reader *r, bool report_errors)
 
   zip_member_ref (content);
 
+  if (r->xtr)
+    xmlFreeTextReader (r->xtr);
 
   xtr = xmlReaderForIO ((xmlInputReadCallback) zip_member_read,
                        (xmlInputCloseCallback) zip_member_finish,
@@ -934,7 +936,7 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_)
          for (col = 0; col < r->col_span; ++col)
            {
              const struct variable *var;
-             const int idx = r->col + col - r->start_col - 1;
+             const int idx = r->col - col - r->start_col - 1;
              if (idx < 0)
                continue;
              if (r->stop_col != -1 && idx > r->stop_col - r->start_col )