[Libreoffice-commits] core.git: sal/osl

Caolán McNamara caolanm at redhat.com
Sun Apr 7 08:03:29 PDT 2013


 sal/osl/unx/module.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit e1248e0f0dcf427b4e8b8615d08524e6f3c4cc77
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Apr 7 09:59:11 2013 -0500

    fix up c code after move to c++
    
    Change-Id: Id3de792f47c778c7a79cc9160ca3480affcaf3cf

diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx
index 43ff2a4e..ebeceb6 100644
--- a/sal/osl/unx/module.cxx
+++ b/sal/osl/unx/module.cxx
@@ -48,14 +48,16 @@ static sal_Bool getModulePathFromAddress(void * address, rtl_String ** path) {
     char *buf, *filename=NULL;
     struct ld_info *lp;
 
-    if ((buf = malloc(size)) == NULL)
-        return result;
+    if ((buf = (char*)malloc(size)) == NULL)
+        return false;
 
-    while(loadquery(L_GETINFO, buf, size) == -1 && errno == ENOMEM)
+    //figure out how big a buffer we need
+    while (loadquery(L_GETINFO, buf, size) == -1 && errno == ENOMEM)
     {
         size += 4 * 1024;
-        if ((buf = malloc(size)) == NULL)
-            break;
+        free(buf);
+        if ((buf = (char*)malloc(size)) == NULL)
+            return false;
     }
 
     lp = (struct ld_info*) buf;


More information about the Libreoffice-commits mailing list