Gitweb links:

...log 
http://git.netsurf-browser.org/libdom.git/shortlog/77c5d9f20a3e51b64a065e14449333b7a1e9f00d
...commit 
http://git.netsurf-browser.org/libdom.git/commit/77c5d9f20a3e51b64a065e14449333b7a1e9f00d
...tree 
http://git.netsurf-browser.org/libdom.git/tree/77c5d9f20a3e51b64a065e14449333b7a1e9f00d

The branch, master has been updated
       via  77c5d9f20a3e51b64a065e14449333b7a1e9f00d (commit)
      from  c3673402999c587dde0292aea9f1de06600a59e1 (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/commit/?id=77c5d9f20a3e51b64a065e14449333b7a1e9f00d
commit 77c5d9f20a3e51b64a065e14449333b7a1e9f00d
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    Correct COLLECT logic in walk_logic_adjacent_text_in_order to stop leak

diff --git a/src/core/text.c b/src/core/text.c
index 3b726fd..b73e86d 100644
--- a/src/core/text.c
+++ b/src/core/text.c
@@ -381,21 +381,32 @@ dom_exception walk_logic_adjacent_text_in_order(
                        assert(node->last_child == NULL);
                        if (opt == COLLECT) {
                                err = dom_characterdata_get_data(node, &data);
-                               if (err == DOM_NO_ERR)
+                               if (err != DOM_NO_ERR)
                                        return err;
 
                                tmp = *ret;
                                if (order == LEFT) {
-                                       err = dom_string_concat(data, tmp, ret);
-                                       if (err == DOM_NO_ERR)
-                                               return err;
+                                       if (tmp != NULL) {
+                                               err = dom_string_concat(data, 
tmp, ret);
+                                               if (err != DOM_NO_ERR)
+                                                       return err;
+                                       } else {
+                                               dom_string_ref(data);
+                                               *ret = data;
+                                       }
                                } else if (order == RIGHT) {
-                                       err = dom_string_concat(tmp, data, ret);
-                                       if (err == DOM_NO_ERR)
-                                               return err;
+                                       if (tmp != NULL) {
+                                               err = dom_string_concat(tmp, 
data, ret);
+                                               if (err != DOM_NO_ERR)
+                                                       return err;
+                                       } else {
+                                               dom_string_ref(data);
+                                               *ret = data;
+                                       }
                                }
 
-                               dom_string_unref(tmp);
+                               if (tmp != NULL)
+                                       dom_string_unref(tmp);
                                dom_string_unref(data);
 
                                *cont = true;


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

Summary of changes:
 src/core/text.c |   27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/core/text.c b/src/core/text.c
index 3b726fd..b73e86d 100644
--- a/src/core/text.c
+++ b/src/core/text.c
@@ -381,21 +381,32 @@ dom_exception walk_logic_adjacent_text_in_order(
                        assert(node->last_child == NULL);
                        if (opt == COLLECT) {
                                err = dom_characterdata_get_data(node, &data);
-                               if (err == DOM_NO_ERR)
+                               if (err != DOM_NO_ERR)
                                        return err;
 
                                tmp = *ret;
                                if (order == LEFT) {
-                                       err = dom_string_concat(data, tmp, ret);
-                                       if (err == DOM_NO_ERR)
-                                               return err;
+                                       if (tmp != NULL) {
+                                               err = dom_string_concat(data, 
tmp, ret);
+                                               if (err != DOM_NO_ERR)
+                                                       return err;
+                                       } else {
+                                               dom_string_ref(data);
+                                               *ret = data;
+                                       }
                                } else if (order == RIGHT) {
-                                       err = dom_string_concat(tmp, data, ret);
-                                       if (err == DOM_NO_ERR)
-                                               return err;
+                                       if (tmp != NULL) {
+                                               err = dom_string_concat(tmp, 
data, ret);
+                                               if (err != DOM_NO_ERR)
+                                                       return err;
+                                       } else {
+                                               dom_string_ref(data);
+                                               *ret = data;
+                                       }
                                }
 
-                               dom_string_unref(tmp);
+                               if (tmp != NULL)
+                                       dom_string_unref(tmp);
                                dom_string_unref(data);
 
                                *cont = true;


-- 
Document Object Model library

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to