File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -396,6 +396,8 @@ fn(init_copy(VecName *dst_vec, VecName const *src_vec)) mlib_noexcept
396396 if (!fn (reserve (& tmp , src_vec -> size ))) {
397397 // We failed to reserve capacity in the new vector
398398 fn (destroy (& tmp ));
399+ // Always leave `dst_vec` in an initialized state.
400+ * dst_vec = (VecName ){NULL , 0 , 0 };
399401 return false;
400402 }
401403 // Copy everything into the destination element-by-element
@@ -412,6 +414,8 @@ fn(init_copy(VecName *dst_vec, VecName const *src_vec)) mlib_noexcept
412414 if (!VecCopyElement ((out_iter ), (in_iter ))) {
413415 // Failed copying here. Undo everything by destroying the temporary
414416 fn (destroy (& tmp ));
417+ // Always leave `dst_vec` in an initialized state.
418+ * dst_vec = (VecName ){NULL , 0 , 0 };
415419 return false;
416420 }
417421 // Update the size of the temporary vec to record that it is holding the new
You can’t perform that action at this time.
0 commit comments