Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/2fe884be6532bb86ed8e2f2aa3d278ebaee6a406
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/2fe884be6532bb86ed8e2f2aa3d278ebaee6a406
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/2fe884be6532bb86ed8e2f2aa3d278ebaee6a406

The branch, master has been updated
       via  2fe884be6532bb86ed8e2f2aa3d278ebaee6a406 (commit)
      from  71afaacc80c6d94e1406249c61c338a4131d24a7 (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=2fe884be6532bb86ed8e2f2aa3d278ebaee6a406
commit 2fe884be6532bb86ed8e2f2aa3d278ebaee6a406
Author: Chris Young <[email protected]>
Commit: Chris Young <[email protected]>

    Fix memory leak searching for resources

diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 3e68c90..7265f8f 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -350,18 +350,19 @@ static bool ami_gui_check_resource(char *fullpath, const 
char *file)
        BPTR lock = 0;
        size_t fullpath_len = 1024;
 
-       ami_gui_map_filename(&remapped, fullpath, file, "Resource.map");
-       netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, remapped);
+       if(ami_gui_map_filename(&remapped, fullpath, file, "Resource.map") == 
true) {
+               netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, remapped);
 
-       lock = Lock(fullpath, ACCESS_READ);
-       if(lock)
-       {
-               UnLock(lock);
-               found = true;
-       }
+               lock = Lock(fullpath, ACCESS_READ);
+               if(lock)
+               {
+                       UnLock(lock);
+                       found = true;
+               }
 
-       if(found) LOG("Found %s", fullpath);
-       free(remapped);
+               if(found) LOG("Found %s", fullpath);
+               free(remapped);
+       }
 
        return found;
 }
@@ -371,7 +372,7 @@ bool ami_locate_resource(char *fullpath, const char *file)
        struct Locale *locale;
        int i;
        bool found = false;
-       char *remapped;
+       char *remapped = NULL;
        size_t fullpath_len = 1024;
 
        /* Check NetSurf user data area first */
@@ -397,11 +398,12 @@ bool ami_locate_resource(char *fullpath, const char *file)
                strcpy(fullpath, "PROGDIR:Resources/");
 
                if(locale->loc_PrefLanguages[i]) {
-                       ami_gui_map_filename(&remapped, "PROGDIR:Resources",
-                               locale->loc_PrefLanguages[i], "LangNames");
-                       netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, 
remapped);
-
-                       found = ami_gui_check_resource(fullpath, file);
+                       if(ami_gui_map_filename(&remapped, "PROGDIR:Resources",
+                                       locale->loc_PrefLanguages[i], 
"LangNames") == true) {
+                               netsurf_mkpath(&fullpath, &fullpath_len, 2, 
fullpath, remapped);
+                               found = ami_gui_check_resource(fullpath, file);
+                               free(remapped);
+                       }
                } else {
                        continue;
                }


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

Summary of changes:
 frontends/amiga/gui.c |   34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index 3e68c90..7265f8f 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -350,18 +350,19 @@ static bool ami_gui_check_resource(char *fullpath, const 
char *file)
        BPTR lock = 0;
        size_t fullpath_len = 1024;
 
-       ami_gui_map_filename(&remapped, fullpath, file, "Resource.map");
-       netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, remapped);
+       if(ami_gui_map_filename(&remapped, fullpath, file, "Resource.map") == 
true) {
+               netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, remapped);
 
-       lock = Lock(fullpath, ACCESS_READ);
-       if(lock)
-       {
-               UnLock(lock);
-               found = true;
-       }
+               lock = Lock(fullpath, ACCESS_READ);
+               if(lock)
+               {
+                       UnLock(lock);
+                       found = true;
+               }
 
-       if(found) LOG("Found %s", fullpath);
-       free(remapped);
+               if(found) LOG("Found %s", fullpath);
+               free(remapped);
+       }
 
        return found;
 }
@@ -371,7 +372,7 @@ bool ami_locate_resource(char *fullpath, const char *file)
        struct Locale *locale;
        int i;
        bool found = false;
-       char *remapped;
+       char *remapped = NULL;
        size_t fullpath_len = 1024;
 
        /* Check NetSurf user data area first */
@@ -397,11 +398,12 @@ bool ami_locate_resource(char *fullpath, const char *file)
                strcpy(fullpath, "PROGDIR:Resources/");
 
                if(locale->loc_PrefLanguages[i]) {
-                       ami_gui_map_filename(&remapped, "PROGDIR:Resources",
-                               locale->loc_PrefLanguages[i], "LangNames");
-                       netsurf_mkpath(&fullpath, &fullpath_len, 2, fullpath, 
remapped);
-
-                       found = ami_gui_check_resource(fullpath, file);
+                       if(ami_gui_map_filename(&remapped, "PROGDIR:Resources",
+                                       locale->loc_PrefLanguages[i], 
"LangNames") == true) {
+                               netsurf_mkpath(&fullpath, &fullpath_len, 2, 
fullpath, remapped);
+                               found = ami_gui_check_resource(fullpath, file);
+                               free(remapped);
+                       }
                } else {
                        continue;
                }


-- 
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