MATLAB C API: What does mxDestroyArray(NULL) do?
I use MATLAB's mxDestroyArray() function and wonder how to do proper error handling. If I called mxCreate*Array() or similiar, I get a valid pointer on success and NULL on failure, i. e. if memory is full. If I create several arrays in this way and at least one fails, I would like to free all what I don't need any longer. Here I am wondering: Do I need to explicitly check every value? if (error) { if (a) mxDestroyArray(a); if (b) mxDestroyArray(b); if (c) mxDestroyArray(c); } or can I just omit the checks? if (error) { mxDestroyArray(a); mxDestroyArray(b); mxDestroyArray(c); }
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.