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

José Guilherme Vanz vanz at libreoffice.org
Sat Mar 1 08:01:48 PST 2014


 sal/osl/unx/pipe.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit f6141d884b7a89a856a34dc93991dbe01ded0b6b
Author: José Guilherme Vanz <vanz at libreoffice.org>
Date:   Sat Nov 2 17:49:16 2013 -0200

    fdo#71043 -  Use STACK lint tool to clean code
    
    The code is using a pointer without check if it is not null.
    
    Change-Id: Icb2dcf8d41a35514e18a5881f59399951b3e0493
    Reviewed-on: https://gerrit.libreoffice.org/6529
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c
index e271e94..79e847e 100644
--- a/sal/osl/unx/pipe.c
+++ b/sal/osl/unx/pipe.c
@@ -98,6 +98,8 @@ oslPipe __osl_createPipeImpl()
     oslPipe pPipeImpl;
 
     pPipeImpl = (oslPipe)calloc(1, sizeof(struct oslPipeImpl));
+    if (pPipeImpl == NULL)
+        return NULL;
     pPipeImpl->m_nRefCount =1;
     pPipeImpl->m_bClosed = sal_False;
 #if defined(LINUX)
@@ -230,7 +232,13 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions
     }
 
     /* alloc memory */
-    pPipe= __osl_createPipeImpl();
+    pPipe = __osl_createPipeImpl();
+
+    if (pPipe == NULL)
+    {
+        OSL_TRACE("__osl_createPipe socket failed");
+        return NULL;
+    }
 
     /* create socket */
     pPipe->m_Socket = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -467,7 +475,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
     else
     {
         /* alloc memory */
-        pAcceptedPipe= __osl_createPipeImpl();
+        pAcceptedPipe = __osl_createPipeImpl();
 
         OSL_ASSERT(pAcceptedPipe);
         if(pAcceptedPipe==NULL)


More information about the Libreoffice-commits mailing list