Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3897

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/97/3897/1

coverity#1000721 Resource Leak

Change-Id: I59161a08eee0406ac71b1212a0a8697edf27911f
---
M desktop/source/lib/shim.cxx
1 file changed, 8 insertions(+), 1 deletion(-)



diff --git a/desktop/source/lib/shim.cxx b/desktop/source/lib/shim.cxx
index 546d0da..8c47dc4 100644
--- a/desktop/source/lib/shim.cxx
+++ b/desktop/source/lib/shim.cxx
@@ -31,7 +31,12 @@
 {
     if( !install_path )
         return NULL;
-    char *imp_lib = (char *) malloc( strlen (install_path) + sizeof( TARGET_LIB ) + 2 );
+    char* imp_lib = (char *) malloc( strlen (install_path) + sizeof( TARGET_LIB ) + 2 );
+    if(!imp_lib)
+    {
+        fprintf( stderr, "failed to open library : not enough memory\n");
+        return NULL;
+    }
     strcpy( imp_lib, install_path );
     strcat( imp_lib, "/" );
     strcat( imp_lib, TARGET_LIB );
@@ -39,12 +44,14 @@
     if( !dlhandle )
     {
         fprintf( stderr, "failed to open library '%s'\n", imp_lib );
+        free( imp_lib );
         return NULL;
     }
 
     HookFunction *pSym = (HookFunction *) dlsym( dlhandle, "liblibreoffice_hook" );
     if( !pSym ) {
         fprintf( stderr, "failed to find hook in library '%s'\n", imp_lib );
+        free( imp_lib );
         return NULL;
     }
 

-- 
To view, visit https://gerrit.libreoffice.org/3897
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I59161a08eee0406ac71b1212a0a8697edf27911f
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Norbert Thiebaud <nthiebaud@gmail.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.