Mark vectors as NAN instead of dereferencing NULL pointers on malloc failure