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


Hi,

a second try.
Making cppcheck happy is not easy...

The first file may be ok.

The second no : but what to do ? loose memory or risk a fail ?
        /* very strange case, but have to believe it: reduce the
         * full qualified name to the unqualified host name */
        if ( !bHostsAreEqual )
        {
            OSL_TRACE("_osl_getFullQualifiedDomainName: "
                      "suspect FQDN: %s\n", pFullQualifiedName);

            pFullQualifiedName[ nLengthOfHostName ] = '\0';
            pFullQualifiedName = (sal_Char*)realloc ( pFullQualifiedName,
                                (nLengthOfHostName + 1) * sizeof( sal_Char ));
        }
    }
    /* always return a hostname looked up as carefully as possible
     * this string must be freed by the caller */

And in "ure/sal/osl/w32/security.c"

            DWORD  nInfoBuffer = 512;
            UCHAR* pInfoBuffer = malloc(nInfoBuffer);

            while (!GetTokenInformation(hAccessToken, TokenUser,
                                           pInfoBuffer, nInfoBuffer,
&nInfoBuffer))
            {
                if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
                    pInfoBuffer = realloc(pInfoBuffer, nInfoBuffer);
                else
                {
                    free(pInfoBuffer);
                    pInfoBuffer = NULL;
                    break;
                }
            }
I'm dumb...

And that was the C side... Let's try C++...

Regards.

Attachment: realloc_patch_1.patch
Description: Binary data

Attachment: realloc_patch_2.patch
Description: Binary data


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.