Fixed a dereference issue where ndims was greater than 0 but the allocation for dimids would fail. Identified by clang static analysis.
Fixed a static-analysis identified issue related to a variable without a value.