Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/7c3da95a07f0d21860e6803567b0603127c517c1
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/7c3da95a07f0d21860e6803567b0603127c517c1
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/7c3da95a07f0d21860e6803567b0603127c517c1

The branch, master has been updated
       via  7c3da95a07f0d21860e6803567b0603127c517c1 (commit)
      from  216fb88f58227f94e87d9e9926b599161a8e65bb (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/netsurf.git/commit/?id=7c3da95a07f0d21860e6803567b0603127c517c1
commit 7c3da95a07f0d21860e6803567b0603127c517c1
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    Resolve resource leak on error (coverity issue 1390560)

diff --git a/utils/messages.c b/utils/messages.c
index e1e6120..2e22cc7 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -57,16 +57,16 @@ static nserror messages_load_ctx(const char *path, struct 
hash_table **ctx)
 {
        struct hash_table *nctx; /* new context */
        nserror res;
-       
-       if (*ctx == NULL) {
-               nctx = hash_create(HASH_SIZE);
-       } else {
+
+       if (*ctx != NULL) {
                /**
                 * \note The passed hash is not copied here so this
                 * updates in place.
                 */
-               nctx = *ctx;
+               return hash_add_file(*ctx, path);
        }
+
+       nctx = hash_create(HASH_SIZE);
        if (nctx == NULL) {
                NSLOG(netsurf, INFO,
                      "Unable to create hash table for messages file %s",
@@ -74,10 +74,11 @@ static nserror messages_load_ctx(const char *path, struct 
hash_table **ctx)
                return NSERROR_NOMEM;
        }
 
-
        res = hash_add_file(nctx, path);
        if (res == NSERROR_OK) {
                *ctx = nctx;
+       } else {
+               hash_destroy(nctx);
        }
 
        return res;
@@ -337,4 +338,3 @@ void messages_destroy(void)
        messages_destroy_ctx(messages_hash);
        messages_hash = NULL;
 }
-


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

Summary of changes:
 utils/messages.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/utils/messages.c b/utils/messages.c
index e1e6120..2e22cc7 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -57,16 +57,16 @@ static nserror messages_load_ctx(const char *path, struct 
hash_table **ctx)
 {
        struct hash_table *nctx; /* new context */
        nserror res;
-       
-       if (*ctx == NULL) {
-               nctx = hash_create(HASH_SIZE);
-       } else {
+
+       if (*ctx != NULL) {
                /**
                 * \note The passed hash is not copied here so this
                 * updates in place.
                 */
-               nctx = *ctx;
+               return hash_add_file(*ctx, path);
        }
+
+       nctx = hash_create(HASH_SIZE);
        if (nctx == NULL) {
                NSLOG(netsurf, INFO,
                      "Unable to create hash table for messages file %s",
@@ -74,10 +74,11 @@ static nserror messages_load_ctx(const char *path, struct 
hash_table **ctx)
                return NSERROR_NOMEM;
        }
 
-
        res = hash_add_file(nctx, path);
        if (res == NSERROR_OK) {
                *ctx = nctx;
+       } else {
+               hash_destroy(nctx);
        }
 
        return res;
@@ -337,4 +338,3 @@ void messages_destroy(void)
        messages_destroy_ctx(messages_hash);
        messages_hash = NULL;
 }
-


-- 
NetSurf Browser

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

Reply via email to