#include <windows.h>
int csOpsPrintDataInitialized = 0;
void ObtainOpsPrintDataCritSect()
{
CreateCriticalSectionAsNeccessary();
EnterCriticalSection(&csOpsPrintData);
} // Hp fortify in visual studio 2013 reporting issue: Exception handling.
but on using try catch it is still reporting same issue.
void ObtainOpsPrintDataCritSect_sol()] { try { EnterCriticalSection(&csOpsPrintData); } catch(char *msg) { } }
Hp fortify recommendation: This problem can be avoided in two ways:
-
Wrap calls to EnterCriticalSection() in a try/catch block.
-
Call the function InitializeCriticalSectionAndSpinCount() instead of InitializeCriticalSection(). This pre-allocates the event that EnterCriticalSection() uses rather than forcing EnterCriticalSection() to allocate the event.
Aucun commentaire:
Enregistrer un commentaire