@@ -620,8 +620,7 @@ static struct snapshot *create_snapshot(struct packed_ref_store *refs)
620
620
621
621
/* If the file has a header line, process it: */
622
622
if (snapshot -> buf < snapshot -> eof && * snapshot -> buf == '#' ) {
623
- struct strbuf tmp = STRBUF_INIT ;
624
- char * p , * eol ;
623
+ char * tmp , * p , * eol ;
625
624
struct string_list traits = STRING_LIST_INIT_NODUP ;
626
625
627
626
eol = memchr (snapshot -> buf , '\n' ,
@@ -631,9 +630,9 @@ static struct snapshot *create_snapshot(struct packed_ref_store *refs)
631
630
snapshot -> buf ,
632
631
snapshot -> eof - snapshot -> buf );
633
632
634
- strbuf_add ( & tmp , snapshot -> buf , eol - snapshot -> buf );
633
+ tmp = xmemdupz ( snapshot -> buf , eol - snapshot -> buf );
635
634
636
- if (!skip_prefix (tmp . buf , "# pack-refs with:" , (const char * * )& p ))
635
+ if (!skip_prefix (tmp , "# pack-refs with:" , (const char * * )& p ))
637
636
die_invalid_line (refs -> path ,
638
637
snapshot -> buf ,
639
638
snapshot -> eof - snapshot -> buf );
@@ -653,7 +652,7 @@ static struct snapshot *create_snapshot(struct packed_ref_store *refs)
653
652
snapshot -> start = eol + 1 ;
654
653
655
654
string_list_clear (& traits , 0 );
656
- strbuf_release ( & tmp );
655
+ free ( tmp );
657
656
}
658
657
659
658
verify_buffer_safe (snapshot );
0 commit comments