diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-04-07 09:59:11 -0500 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-04-07 16:03:08 +0100 |
commit | e1248e0f0dcf427b4e8b8615d08524e6f3c4cc77 (patch) | |
tree | 78bd3a37b568a558db769d239dd0754aa4675136 /sal/osl | |
parent | 8d11a1e522b83bdf1c9d0f952a5415359dee6851 (diff) |
fix up c code after move to c++
Change-Id: Id3de792f47c778c7a79cc9160ca3480affcaf3cf
Diffstat (limited to 'sal/osl')
-rw-r--r-- | sal/osl/unx/module.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sal/osl/unx/module.cxx b/sal/osl/unx/module.cxx index 43ff2a4e3a75..ebeceb62b139 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; |