@@ -714,8 +714,10 @@ static int midx_write(
714714 error = git_vector_init (& object_entries , git_array_size (object_entries_array ), object_entry__cmp );
715715 if (error < 0 )
716716 goto cleanup ;
717- git_array_foreach (object_entries_array , i , entry )
718- error = git_vector_set (NULL , & object_entries , i , entry );
717+ git_array_foreach (object_entries_array , i , entry ) {
718+ if ((error = git_vector_set (NULL , & object_entries , i , entry )) < 0 )
719+ goto cleanup ;
720+ }
719721 git_vector_set_sorted (& object_entries , 0 );
720722 git_vector_sort (& object_entries );
721723 git_vector_uniq (& object_entries , NULL );
@@ -751,10 +753,12 @@ static int midx_write(
751753 goto cleanup ;
752754 if (entry -> offset >= 0x80000000l ) {
753755 word = htonl (0x80000000u | object_large_offsets_count ++ );
754- error = write_offset (entry -> offset , midx_write_buf , & object_large_offsets );
756+ if ((error = write_offset (entry -> offset , midx_write_buf , & object_large_offsets )) < 0 )
757+ goto cleanup ;
755758 } else {
756759 word = htonl ((uint32_t )entry -> offset & 0x7fffffffu );
757760 }
761+
758762 error = git_buf_put (& object_offsets , (const char * )& word , sizeof (word ));
759763 if (error < 0 )
760764 goto cleanup ;
0 commit comments