Fix some memory leaks
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 1 Mar 2013 19:39:28 +0000 (20:39 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 1 Mar 2013 19:39:28 +0000 (20:39 +0100)
src/data/ods-reader.c

index ab8b84a44484449e4eefe813c25be9c51c3da8c2..a8c67d30ed9474a7702aa516b0d5705a43685764 100644 (file)
@@ -317,10 +317,10 @@ process_node (struct ods_reader *r)
          r->col_span = value ? _xmlchar_to_int (value) : 1;
          r->col += r->col_span;
 
-         //      printf ("%s:%d %s\n", __FILE__, __LINE__, value);
-
          if (! xmlTextReaderIsEmptyElement (r->xtr))
            r->state = STATE_CELL;
+
+         xmlFree (value);
        }
       else if ( (0 == xmlStrcasecmp (name, _xml ("table:table-row")))
                &&
@@ -480,14 +480,21 @@ get_sheet_count (struct zip_reader *zreader)
       if ( 0 == xmlStrcmp (name, _xml("meta:document-statistic")))
        {
          xmlChar *attr = xmlTextReaderGetAttribute (mxtr, _xml ("meta:table-count"));
-           
+
          if ( attr != NULL)
            {
              int s = _xmlchar_to_int (attr);
+             xmlFreeTextReader (mxtr);
+             xmlFree (name);
+             xmlFree (attr);      
              return s;
            }
+         xmlFree (attr);      
        }
+      xmlFree (name);      
     }
+
+  xmlFreeTextReader (mxtr);
   return -1;
 }