DRuttkay131692 (Community Member) asked a question.

[C++] Checks for valid memory pointers not recognized when inside the condition part of the if-statement

"The result of this call to _wcsdup() is not checked for success before being used." - Reported 8 times, on the line where strH is handled

 

if (!pInfo ||

   NULL == (pInfo->strA  = _wcsdup(strA)) ||

   (NULL != strB && NULL == (pInfo->strB = _wcsdup(strB))) ||

   (NULL != strC && NULL == (pInfo->strC = _wcsdup(strC))) ||

   (boolA && NULL != strD && NULL == (pInfo->strE = _wcsdup(strD))) ||

   (!boolA && NULL != strD && NULL == (pInfo->strF = _wcsdup(strD))) ||

   (NULL != strG && NULL == (pInfo->strG = _wcsdup(strG))) ||

   (NULL != strH && NULL == (pInfo->strH = _wcsdup (strH))) ||

   (NULL != strI && NULL == (pInfo->strI = _wcsdup (strI)))

  )

   return pushError (ERR_ALLOCATE_MEM);


Topics (1)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.