[Libreoffice-commits] .: 2 commits - odk/source sal/osl

Michael Meeks michael at kemper.freedesktop.org
Fri Jun 8 06:13:40 PDT 2012


 odk/source/unoapploader/unx/unoapploader.c |    6 ++----
 odk/source/unoapploader/win/unoapploader.c |    6 ++----
 sal/osl/w32/security.c                     |   24 ++----------------------
 3 files changed, 6 insertions(+), 30 deletions(-)

New commits:
commit 78b7f6e138c561ccc3082a93b155934b4b9c3649
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Jun 8 14:10:57 2012 +0100

    targetted revert of minor cppcheck cleanup
    
    Change-Id: Id3100ef8f8381bc05e5a01c56fc5d611094857bf

diff --git a/odk/source/unoapploader/unx/unoapploader.c b/odk/source/unoapploader/unx/unoapploader.c
index 90c1cd1..e744f1b 100644
--- a/odk/source/unoapploader/unx/unoapploader.c
+++ b/odk/source/unoapploader/unx/unoapploader.c
@@ -148,15 +148,13 @@ int main( int argc, char *argv[] )
             libpath = NULL;
             for (;;) {
                 size_t m;
-                char * test = realloc(libpath, n);
-                if (test == NULL) {
+                libpath = realloc(libpath, n);
+                if (libpath == NULL) {
                     fprintf(
                         stderr,
                         "Error: out of memory reading unoinfo output!\n");
-                    free(libpath);
                     exit(EXIT_FAILURE);
                 }
-                libpath = test;
                 m = fread(libpath + old, 1, n - old - 1, f);
                 if (m != n - old - 1) {
                     if (ferror(f)) {
diff --git a/odk/source/unoapploader/win/unoapploader.c b/odk/source/unoapploader/win/unoapploader.c
index 8debafe..ca17ce7 100644
--- a/odk/source/unoapploader/win/unoapploader.c
+++ b/odk/source/unoapploader/win/unoapploader.c
@@ -152,15 +152,13 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
             CloseHandle(procinfo.hThread);
             for (;;) {
                 DWORD m;
-                char * test = realloc(buf, n);
-                if (test == NULL) {
+                buf = realloc(buf, n);
+                if (buf == NULL) {
                     writeError(
                         "Error: out of memory reading unoinfo output!\n");
                     closeErrorFile();
-                    free(buf);
                     return 1;
                 }
-                buf = test;
                 if (!ReadFile(stdoutRead, buf + k, n - k, &m, NULL))
                 {
                     DWORD err = GetLastError();
commit d376d6649bbdca6a5d36c8ef2a43ce3890c01d89
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Jun 8 14:08:51 2012 +0100

    targetted reversion of minor cppcheck fix
    
    Change-Id: If67666bccbde6d2104295c5480c3eceb95b6ce35

diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c
index d2e0ef7..82fd833 100644
--- a/sal/osl/w32/security.c
+++ b/sal/osl/w32/security.c
@@ -338,17 +338,7 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
                                            pInfoBuffer, nInfoBuffer, &nInfoBuffer))
             {
                 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-                {
-                    UCHAR* pTmp = realloc(pInfoBuffer, nInfoBuffer);
-                    if (pTmp)
-                        pInfoBuffer = pTmp;
-                    else
-                    {
-                        free(pInfoBuffer);
-                        pInfoBuffer = NULL;
-                        break;
-                    }
-                }
+                    pInfoBuffer = realloc(pInfoBuffer, nInfoBuffer);
                 else
                 {
                     free(pInfoBuffer);
@@ -875,17 +865,7 @@ static sal_Bool SAL_CALL getUserNameImpl(oslSecurity Security, rtl_uString **str
                                            pInfoBuffer, nInfoBuffer, &nInfoBuffer))
             {
                 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
-                {
-                    UCHAR* pTmp = realloc(pInfoBuffer, nInfoBuffer);
-                    if (pTmp)
-                        pInfoBuffer = pTmp;
-                    else
-                    {
-                        free(pInfoBuffer);
-                        pInfoBuffer = NULL;
-                        break;
-                    }
-                }
+                    pInfoBuffer = realloc(pInfoBuffer, nInfoBuffer);
                 else
                 {
                     free(pInfoBuffer);


More information about the Libreoffice-commits mailing list