That technique works for all numbers of rows and columns.
(Row Size) x (Column Size) = (Number of Elements in the 2D Array)
Do you want to start counting from 1 or 0?
If you count from 1, then the last "index" is (Number of Elements in the 2D Array)
If you count from 0, then the last "index" is (Number of Elements in the 2D Array)-1
Try it for different array sizes. You'll see that it always works.
When would the LStrHandles ever be valid? If you allocate a new CodecInfo array, then all the LStrHandles are uninitialized (that means they are never valid).
So the solution is this: For all of the LStrHandles inside your new array of clusters, always call DSNewHandle() and never call DSCheckHandle().
Like I mentioned before, your new LStrHandles are uninitialized pointers. You must never call a function (including DSCheckHandle()) to perform an action on an unitialized pointer. If you do, you will get undefined behaviour (and usually crash) -- This applies to all C/C++ code, not just LabVIEW interface code.