Additionally, use new instead of malloc.
The big thing is to use new with delete or malloc with free. As long as you use one pair you should be fine. What makes new better than malloc besides it is C++ where malloc is more of a C function? I always use new for Qt objects and malloc when dynamically creating arrays.

If you use the 3-dimensional array make sure to free/delete every pointer and not just the overlying pointer.