@@ -623,14 +623,16 @@ func (o *Remote) Fetch(refspecs []string, opts *FetchOptions, msg string) error
623
623
crefspecs .strings = makeCStringsFromStrings (refspecs )
624
624
defer freeStrarray (& crefspecs )
625
625
626
- var coptions C.git_fetch_options
627
- populateFetchOptions (& coptions , opts );
626
+ coptions := (* C .git_fetch_options )(C .calloc (1 , C .size_t (unsafe .Sizeof (C.git_fetch_options {}))))
627
+ defer C .free (unsafe .Pointer (coptions ))
628
+
629
+ populateFetchOptions (coptions , opts )
628
630
defer untrackCalbacksPayload (& coptions .callbacks )
629
631
630
632
runtime .LockOSThread ()
631
633
defer runtime .UnlockOSThread ()
632
634
633
- ret := C .git_remote_fetch (o .ptr , & crefspecs , & coptions , cmsg )
635
+ ret := C .git_remote_fetch (o .ptr , & crefspecs , coptions , cmsg )
634
636
if ret < 0 {
635
637
return MakeGitError (ret )
636
638
}
@@ -710,14 +712,16 @@ func (o *Remote) Push(refspecs []string, opts *PushOptions) error {
710
712
crefspecs .strings = makeCStringsFromStrings (refspecs )
711
713
defer freeStrarray (& crefspecs )
712
714
713
- var coptions C.git_push_options
714
- populatePushOptions (& coptions , opts )
715
+ coptions := (* C .git_push_options )(C .calloc (1 , C .size_t (unsafe .Sizeof (C.git_push_options {}))))
716
+ defer C .free (unsafe .Pointer (coptions ))
717
+
718
+ populatePushOptions (coptions , opts )
715
719
defer untrackCalbacksPayload (& coptions .callbacks )
716
720
717
721
runtime .LockOSThread ()
718
722
defer runtime .UnlockOSThread ()
719
723
720
- ret := C .git_remote_push (o .ptr , & crefspecs , & coptions )
724
+ ret := C .git_remote_push (o .ptr , & crefspecs , coptions )
721
725
if ret < 0 {
722
726
return MakeGitError (ret )
723
727
}
0 commit comments