check pointers before freeing

Reference issue

fixes #2758 (closed)

What does this implement/fix?

This adds a probably negligible cost to free'ing allocated memory, with the advantages described in the referenced issue.

Additional information

Merge request reports

Loading