no need for checks like this if you use `SG_MALLOC`, see:
https://github.com/shogun-toolbox/shogun/blob/develop/src/shogun/lib/memory.cpp#L193