free (r->sheets);
state_data_destroy (&r->msd);
+ free (s->file_name);
+
free (r);
}
}
{
r = xzalloc (sizeof *r);
r->spreadsheet.n_sheets = -1;
- r->spreadsheet.file_name = filename;
+ r->spreadsheet.file_name = strdup (filename);
sd = &r->msd;
}
else
if ( ret != 1)
{
/* Does not seem to be a gnumeric file */
- xmlFreeTextReader (sd->xtr);
- free (r);
+ gnumeric_unref (&r->spreadsheet);
return NULL;
}
zip_reader_destroy (r->zreader);
free (r->sheets);
+
+ free (s->file_name);
free (r);
}
r->n_allocated_sheets = 0;
r->sheets = NULL;
- r->spreadsheet.file_name = filename;
+ r->spreadsheet.file_name = strdup (filename);
return &r->spreadsheet;
error: