Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions backend/epub/epub-document.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ set_xml_root_node(xmlChar* rootname)

if (xmlroot == NULL) {

xmlFreeDoc(xmldocument);
return FALSE;
}

Expand Down Expand Up @@ -896,6 +895,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document)
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
_("container file is corrupt"));
xml_free_doc();
return NULL ;
}

Expand All @@ -906,6 +906,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document)
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
_("epub file is invalid or corrupt"));
xml_free_doc();
return NULL ;
}

Expand All @@ -916,6 +917,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document)
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
_("epub file is corrupt, no container"));
xml_free_doc();
return NULL ;
}

Expand Down Expand Up @@ -958,6 +960,7 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document)
EV_DOCUMENT_ERROR_INVALID,
_("could not retrieve container file"));
}
xml_free_doc();
return NULL ;
}
xml_free_doc();
Expand Down Expand Up @@ -1010,6 +1013,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
_("content file is invalid"));
xml_free_doc();
return FALSE ;
}

Expand All @@ -1019,6 +1023,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
_("epub file has no spine"));
xml_free_doc();
return FALSE ;
}

Expand All @@ -1028,6 +1033,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu
EV_DOCUMENT_ERROR,
EV_DOCUMENT_ERROR_INVALID,
_("epub file has no manifest"));
xml_free_doc();
return FALSE ;
}

Expand Down Expand Up @@ -1122,6 +1128,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu
}
/*free any nodes that were set up and return empty*/
g_list_free_full(newlist, (GDestroyNotify)free_tree_nodes);
xml_free_doc();
return NULL;
}

Expand Down Expand Up @@ -1169,6 +1176,7 @@ get_toc_file_name(gchar *containeruri)

/*In an epub3, there is sometimes no toc, and we need to then use the nav file for this.*/
if (ncx == NULL) {
xml_free_doc();
return NULL;
}

Expand Down Expand Up @@ -1556,7 +1564,9 @@ epub_document_get_alternate_stylesheet(gchar *docuri)
xml_parse_children_of_node(head,(xmlChar*)"link",(xmlChar*)"class",(xmlChar*)"night");

if (xmlretval != NULL) {
return (gchar*)xml_get_data_from_node(xmlretval,XML_ATTRIBUTE,(xmlChar*)"href");
gchar *stylesheet = (gchar*)xml_get_data_from_node(xmlretval,XML_ATTRIBUTE,(xmlChar*)"href");
xml_free_doc();
return stylesheet;
}
xml_free_doc();
return NULL;
Expand Down