@@ -80,7 +80,8 @@ static git_blame_hunk *new_hunk(
8080
8181static void free_hunk (git_blame_hunk * hunk )
8282{
83- git__free ((void * )hunk -> orig_path );
83+ git__free ((char * )hunk -> orig_path );
84+ git__free ((char * )hunk -> summary );
8485 git_signature_free (hunk -> final_signature );
8586 git_signature_free (hunk -> final_committer );
8687 git_signature_free (hunk -> orig_signature );
@@ -107,7 +108,8 @@ static git_blame_hunk *dup_hunk(git_blame_hunk *hunk, git_blame *blame)
107108 if (git_signature_dup (& newhunk -> final_signature , hunk -> final_signature ) < 0 ||
108109 git_signature_dup (& newhunk -> final_committer , hunk -> final_committer ) < 0 ||
109110 git_signature_dup (& newhunk -> orig_signature , hunk -> orig_signature ) < 0 ||
110- git_signature_dup (& newhunk -> orig_committer , hunk -> orig_committer ) < 0 ) {
111+ git_signature_dup (& newhunk -> orig_committer , hunk -> orig_committer ) < 0 ||
112+ (newhunk -> summary = git__strdup (hunk -> summary )) == NULL ) {
111113 free_hunk (newhunk );
112114 return NULL ;
113115 }
@@ -338,6 +340,7 @@ static int index_blob_lines(git_blame *blame)
338340
339341static git_blame_hunk * hunk_from_entry (git_blame__entry * e , git_blame * blame )
340342{
343+ const char * summary ;
341344 git_blame_hunk * h = new_hunk (
342345 e -> lno + 1 , e -> num_lines , e -> s_lno + 1 , e -> suspect -> path ,
343346 blame );
@@ -353,7 +356,9 @@ static git_blame_hunk *hunk_from_entry(git_blame__entry *e, git_blame *blame)
353356 git_commit_committer_with_mailmap (
354357 & h -> final_committer , e -> suspect -> commit , blame -> mailmap ) < 0 ||
355358 git_signature_dup (& h -> orig_signature , h -> final_signature ) < 0 ||
356- git_signature_dup (& h -> orig_committer , h -> final_committer ) < 0 ) {
359+ git_signature_dup (& h -> orig_committer , h -> final_committer ) < 0 ||
360+ (summary = git_commit_summary (e -> suspect -> commit )) == NULL ||
361+ (h -> summary = git__strdup (summary )) == NULL ) {
357362 free_hunk (h );
358363 return NULL ;
359364 }
0 commit comments