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