[Libreoffice-commits] .: sal/osl
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Nov 1 03:01:01 PDT 2010
sal/osl/w32/security.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
New commits:
commit 8ccf1edc4025b914a3aef76bc3cc461e7f718620
Author: Gert Faller <gertfaller at aliceadsl.fr>
Date: Mon Nov 1 10:00:23 2010 +0000
fix cppcheck realloc warning
diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c
index 7c5f905..7d339ba 100644
--- a/sal/osl/w32/security.c
+++ b/sal/osl/w32/security.c
@@ -355,7 +355,17 @@ sal_Bool SAL_CALL osl_getUserIdent(oslSecurity Security, rtl_uString **strIdent)
pInfoBuffer, nInfoBuffer, &nInfoBuffer))
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
- pInfoBuffer = realloc(pInfoBuffer, nInfoBuffer);
+ {
+ UCHAR* pTmp = realloc(pInfoBuffer, nInfoBuffer);
+ if (pTmp)
+ pInfoBuffer = pTmp;
+ else
+ {
+ free(pInfoBuffer);
+ pInfoBuffer = NULL;
+ break;
+ }
+ }
else
{
free(pInfoBuffer);
@@ -913,7 +923,17 @@ static sal_Bool SAL_CALL getUserNameImpl(oslSecurity Security, rtl_uString **str
pInfoBuffer, nInfoBuffer, &nInfoBuffer))
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
- pInfoBuffer = realloc(pInfoBuffer, nInfoBuffer);
+ {
+ UCHAR* pTmp = realloc(pInfoBuffer, nInfoBuffer);
+ if (pTmp)
+ pInfoBuffer = pTmp;
+ else
+ {
+ free(pInfoBuffer);
+ pInfoBuffer = NULL;
+ break;
+ }
+ }
else
{
free(pInfoBuffer);
More information about the Libreoffice-commits
mailing list