Gitweb links:

...log 
http://git.netsurf-browser.org/libdom.git/shortlog/5b82e5a23e4b442bc330783091ed01b95f037175
...commit 
http://git.netsurf-browser.org/libdom.git/commit/5b82e5a23e4b442bc330783091ed01b95f037175
...tree 
http://git.netsurf-browser.org/libdom.git/tree/5b82e5a23e4b442bc330783091ed01b95f037175

The branch, master has been updated
       via  5b82e5a23e4b442bc330783091ed01b95f037175 (commit)
       via  967380654ba87462dfb2faeeefbb3ea481fe05a2 (commit)
      from  b74f19726fd22dbf6eec5cbe8199f2e455d13ef5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libdom.git/commitdiff/5b82e5a23e4b442bc330783091ed01b95f037175
commit 5b82e5a23e4b442bc330783091ed01b95f037175
Author: Daniel Silverstone <dsilv...@digital-scurf.org>
Commit: Daniel Silverstone <dsilv...@digital-scurf.org>

    DOMDocument: Actually free the empty memoised string

diff --git a/src/core/document.c b/src/core/document.c
index c43f0bc..456d906 100644
--- a/src/core/document.c
+++ b/src/core/document.c
@@ -143,7 +143,7 @@ dom_exception _dom_document_initialise(dom_document *doc,
        /* Intern the empty string. The use of a space in the constant
         * is to prevent the compiler warning about an empty string.
         */
-       err = dom_string_create_interned((const uint8_t *) ' ', 0,
+       err = dom_string_create_interned((const uint8_t *) " ", 0,
                                         &doc->_memo_empty);
        if (err != DOM_NO_ERR) {
                dom_string_unref(doc->class_string);
@@ -184,6 +184,7 @@ bool _dom_document_finalise(dom_document *doc)
                dom_string_unref(doc->id_name);
 
        dom_string_unref(doc->class_string);
+       dom_string_unref(doc->_memo_empty);
        
        _dom_document_event_internal_finalise(doc, &doc->dei);
 


commitdiff 
http://git.netsurf-browser.org/libdom.git/commitdiff/967380654ba87462dfb2faeeefbb3ea481fe05a2
commit 967380654ba87462dfb2faeeefbb3ea481fe05a2
Author: Daniel Silverstone <dsilv...@digital-scurf.org>
Commit: Daniel Silverstone <dsilv...@digital-scurf.org>

    HTMLDocument: If finalise is hung, don't free us underneath ourselves

diff --git a/src/html/html_document.c b/src/html/html_document.c
index ddb8196..7644fde 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -116,15 +116,20 @@ out:
 }
 
 /* Finalise a HTMLDocument */
-void _dom_html_document_finalise(dom_html_document *doc)
+bool _dom_html_document_finalise(dom_html_document *doc)
 {
        int sidx;
        
-       dom_string_unref(doc->cookie);
-       dom_string_unref(doc->url);
-       dom_string_unref(doc->domain);
-       dom_string_unref(doc->referrer);
-       dom_string_unref(doc->title);
+       if (doc->cookie != NULL)
+               dom_string_unref(doc->cookie);
+       if (doc->url != NULL)
+               dom_string_unref(doc->url);
+       if (doc->domain != NULL)
+               dom_string_unref(doc->domain);
+       if (doc->referrer != NULL)
+               dom_string_unref(doc->referrer);
+       if (doc->title != NULL)
+               dom_string_unref(doc->title);
        
        if (doc->memoised != NULL) {
                for(sidx = 0; sidx < hds_COUNT; ++sidx) {
@@ -136,7 +141,7 @@ void _dom_html_document_finalise(dom_html_document *doc)
                doc->memoised = NULL;
        }
        
-       _dom_document_finalise(&doc->base);
+       return _dom_document_finalise(&doc->base);
 }
 
 /* Destroy a HTMLDocument */
@@ -144,9 +149,8 @@ void _dom_html_document_destroy(dom_node_internal *node)
 {
        dom_html_document *doc = (dom_html_document *) node;
 
-       _dom_html_document_finalise(doc);
-
-       free(doc);
+       if (_dom_html_document_finalise(doc) == true)
+               free(doc);
 }
 
 dom_exception _dom_html_document_copy(dom_node_internal *old,
diff --git a/src/html/html_document.h b/src/html/html_document.h
index fbe7155..bb1a0d2 100644
--- a/src/html/html_document.h
+++ b/src/html/html_document.h
@@ -38,7 +38,7 @@ dom_exception _dom_html_document_create(
 dom_exception _dom_html_document_initialise(dom_html_document *doc,
                dom_events_default_action_fetcher daf);
 /* Finalise a HTMLDocument */
-void _dom_html_document_finalise(dom_html_document *doc);
+bool _dom_html_document_finalise(dom_html_document *doc);
 
 void _dom_html_document_destroy(dom_node_internal *node);
 dom_exception _dom_html_document_copy(dom_node_internal *old, 


-----------------------------------------------------------------------

Summary of changes:
 src/core/document.c      |    3 ++-
 src/html/html_document.c |   24 ++++++++++++++----------
 src/html/html_document.h |    2 +-
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/src/core/document.c b/src/core/document.c
index c43f0bc..456d906 100644
--- a/src/core/document.c
+++ b/src/core/document.c
@@ -143,7 +143,7 @@ dom_exception _dom_document_initialise(dom_document *doc,
        /* Intern the empty string. The use of a space in the constant
         * is to prevent the compiler warning about an empty string.
         */
-       err = dom_string_create_interned((const uint8_t *) ' ', 0,
+       err = dom_string_create_interned((const uint8_t *) " ", 0,
                                         &doc->_memo_empty);
        if (err != DOM_NO_ERR) {
                dom_string_unref(doc->class_string);
@@ -184,6 +184,7 @@ bool _dom_document_finalise(dom_document *doc)
                dom_string_unref(doc->id_name);
 
        dom_string_unref(doc->class_string);
+       dom_string_unref(doc->_memo_empty);
        
        _dom_document_event_internal_finalise(doc, &doc->dei);
 
diff --git a/src/html/html_document.c b/src/html/html_document.c
index ddb8196..7644fde 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -116,15 +116,20 @@ out:
 }
 
 /* Finalise a HTMLDocument */
-void _dom_html_document_finalise(dom_html_document *doc)
+bool _dom_html_document_finalise(dom_html_document *doc)
 {
        int sidx;
        
-       dom_string_unref(doc->cookie);
-       dom_string_unref(doc->url);
-       dom_string_unref(doc->domain);
-       dom_string_unref(doc->referrer);
-       dom_string_unref(doc->title);
+       if (doc->cookie != NULL)
+               dom_string_unref(doc->cookie);
+       if (doc->url != NULL)
+               dom_string_unref(doc->url);
+       if (doc->domain != NULL)
+               dom_string_unref(doc->domain);
+       if (doc->referrer != NULL)
+               dom_string_unref(doc->referrer);
+       if (doc->title != NULL)
+               dom_string_unref(doc->title);
        
        if (doc->memoised != NULL) {
                for(sidx = 0; sidx < hds_COUNT; ++sidx) {
@@ -136,7 +141,7 @@ void _dom_html_document_finalise(dom_html_document *doc)
                doc->memoised = NULL;
        }
        
-       _dom_document_finalise(&doc->base);
+       return _dom_document_finalise(&doc->base);
 }
 
 /* Destroy a HTMLDocument */
@@ -144,9 +149,8 @@ void _dom_html_document_destroy(dom_node_internal *node)
 {
        dom_html_document *doc = (dom_html_document *) node;
 
-       _dom_html_document_finalise(doc);
-
-       free(doc);
+       if (_dom_html_document_finalise(doc) == true)
+               free(doc);
 }
 
 dom_exception _dom_html_document_copy(dom_node_internal *old,
diff --git a/src/html/html_document.h b/src/html/html_document.h
index fbe7155..bb1a0d2 100644
--- a/src/html/html_document.h
+++ b/src/html/html_document.h
@@ -38,7 +38,7 @@ dom_exception _dom_html_document_create(
 dom_exception _dom_html_document_initialise(dom_html_document *doc,
                dom_events_default_action_fetcher daf);
 /* Finalise a HTMLDocument */
-void _dom_html_document_finalise(dom_html_document *doc);
+bool _dom_html_document_finalise(dom_html_document *doc);
 
 void _dom_html_document_destroy(dom_node_internal *node);
 dom_exception _dom_html_document_copy(dom_node_internal *old, 


-- 
Document Object Model library

_______________________________________________
netsurf-commits mailing list
netsurf-commits@netsurf-browser.org
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to