[gnumeric] Fix possible freeing of unallocated document



commit 172f4eecee8c712c2bd7924cd3aac69a46327bea
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Jul 26 12:19:34 2013 -0600

    Fix possible freeing of unallocated document
    
    2013-07-26  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (openoffice_file_open): don't free docs, unless we
        in fact created them

 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 3fbcc34..fd17696 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2013-07-26  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (openoffice_file_open): don't free docs, unless we
+       in fact created them
+
 2013-07-25  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (opendoc_content_preparse_dtd): remove
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 5eed20c..e3a6836 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -12420,9 +12420,12 @@ openoffice_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_cont
                                           : opendoc_content_dtd,
                                           gsf_odf_get_ns ());
                content_malformed = !gsf_xml_in_doc_parse (doc, contents, &state);
+               gsf_xml_in_doc_free (doc);
+               odf_clear_conventions (&state);
+               
+               odf_fix_expr_names (&state);
        }
 
-       odf_fix_expr_names (&state);
 
        if (!content_malformed) {
                GsfInput *settings;
@@ -12472,8 +12475,6 @@ openoffice_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *io_cont
                state.settings.settings = NULL;
        }
 
-       gsf_xml_in_doc_free (doc);
-       odf_clear_conventions (&state);
 
        go_io_progress_unset (state.context);
        g_free (state.last_error);


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