@@ -620,8 +620,7 @@ static struct snapshot *create_snapshot(struct packed_ref_store *refs)
620620
621621 /* If the file has a header line, process it: */
622622 if (snapshot -> buf < snapshot -> eof && * snapshot -> buf == '#' ) {
623- struct strbuf tmp = STRBUF_INIT ;
624- char * p , * eol ;
623+ char * tmp , * p , * eol ;
625624 struct string_list traits = STRING_LIST_INIT_NODUP ;
626625
627626 eol = memchr (snapshot -> buf , '\n' ,
@@ -631,9 +630,9 @@ static struct snapshot *create_snapshot(struct packed_ref_store *refs)
631630 snapshot -> buf ,
632631 snapshot -> eof - snapshot -> buf );
633632
634- strbuf_add ( & tmp , snapshot -> buf , eol - snapshot -> buf );
633+ tmp = xmemdupz ( snapshot -> buf , eol - snapshot -> buf );
635634
636- if (!skip_prefix (tmp . buf , "# pack-refs with:" , (const char * * )& p ))
635+ if (!skip_prefix (tmp , "# pack-refs with:" , (const char * * )& p ))
637636 die_invalid_line (refs -> path ,
638637 snapshot -> buf ,
639638 snapshot -> eof - snapshot -> buf );
@@ -653,7 +652,7 @@ static struct snapshot *create_snapshot(struct packed_ref_store *refs)
653652 snapshot -> start = eol + 1 ;
654653
655654 string_list_clear (& traits , 0 );
656- strbuf_release ( & tmp );
655+ free ( tmp );
657656 }
658657
659658 verify_buffer_safe (snapshot );
0 commit comments