@@ -71,6 +71,8 @@ static void copy_promisor_content(struct repository *repo,
7171 dest_idx_name = mkpathdup ("%s-%s.idx" , packtmp , dest_hex );
7272 get_oid_hex_algop (dest_hex , & dest_oid , repo -> hash_algo );
7373 dest_pack = parse_pack_index (repo , dest_oid .hash , dest_idx_name );
74+ if (!dest_pack )
75+ BUG ("parse_pack_index() failed." );
7476
7577 /* Open the .promisor dest file, and fill dest_content with its content */
7678 dest_promisor_name = mkpathdup ("%s-%s.promisor" , packtmp , dest_hex );
@@ -115,7 +117,8 @@ static void copy_promisor_content(struct repository *repo,
115117
116118 /* If <time> doesn't exist, retrieve it and add it to line */
117119 if (line_sections .nr < 3 )
118- strbuf_addf (& line , " %" PRItime , (timestamp_t )source_stat .st_mtime );
120+ strbuf_addf (& line , " %" PRItime ,
121+ (timestamp_t )source_stat .st_mtime );
119122
120123 /*
121124 * Add the finalized line to dest_to_write and dest_content if it
@@ -148,6 +151,7 @@ static void copy_promisor_content(struct repository *repo,
148151 die (_ ("Could not write '%s' promisor file" ), dest_promisor_name );
149152
150153 close_pack_index (dest_pack );
154+ free (dest_pack );
151155 free (dest_idx_name );
152156 free (dest_promisor_name );
153157 strset_clear (& dest_content );
0 commit comments