Coding - Remove redundant null checks before deallocation (#1077)

In C++, delete/delete[] on nullptr and free(NULL) are guaranteed no-ops.
This removes redundant null-check guards before these calls across 39
files, reducing code noise without behavioral change. Also simplifies
map value cleanup in BRepClass3d_SolidExplorer by using iterator
reference instead of redundant hash lookups.
This commit is contained in:
Pasukhin Dmitry
2026-02-13 12:37:51 +00:00
committed by GitHub
parent bdec5d75f6
commit bdddadec19
39 changed files with 123 additions and 304 deletions

View File

@@ -44,11 +44,8 @@ public:
//! Destructor
~MeshVS_Buffer()
{
if (myDynData)
{
Standard::Free(myDynData);
myDynData = nullptr;
}
Standard::Free(myDynData);
myDynData = nullptr;
}
//! Cast the buffer to the void pointer

View File

@@ -608,11 +608,8 @@ void Image_AlienPixMap::Clear()
myPalette = NULL;
}
#elif defined(__EMSCRIPTEN__)
if (myLibImage != NULL)
{
free((void*)myLibImage);
myLibImage = NULL;
}
free((void*)myLibImage);
myLibImage = NULL;
#endif
}