diff options
author | Gert Faller <gertfaller@aliceadsl.fr> | 2010-11-01 10:00:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-11-01 10:00:23 +0000 |
commit | 26d49e1f8da91f50448749d4aeb5227e82827473 (patch) | |
tree | df50dca03ce05e166c76ac77496c59cfa0cf49fc /sal | |
parent | 6698ddb93999097587c9be6ba0c908cf847b1400 (diff) |
fix cppcheck realloc warning
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/w32/security.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c index 9dd074a222f9..a406c4cdd7b2 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); |