Fixes for NULL test for function returns such as malloc() - as reported by Coverity

This commit is contained in:
Mark Riddoch
2013-08-29 13:34:21 +02:00
parent 03725cabe3
commit a445b6ff37
4 changed files with 32 additions and 9 deletions

View File

@ -564,7 +564,8 @@ static int gw_change_user(DCB *backend, SERVER *server, SESSION *in_session, GWB
// allocate memory for token only if auth_token_len > 0
if (auth_token_len) {
auth_token = (uint8_t *)malloc(auth_token_len);
if ((auth_token = (uint8_t *)malloc(auth_token_len)) == NULL)
return rv;
memcpy(auth_token, client_auth_packet, auth_token_len);
client_auth_packet += auth_token_len;
}