@@ -94,6 +94,7 @@ func (repo *Repository) CreateBranch(branchName string, target *Commit, force bo
94
94
95
95
var ptr * C.git_reference
96
96
cBranchName := C .CString (branchName )
97
+ defer C .free (unsafe .Pointer (cBranchName ))
97
98
cForce := cbool (force )
98
99
99
100
cSignature , err := signature .toC ()
@@ -134,6 +135,7 @@ func (b *Branch) Delete() error {
134
135
func (b * Branch ) Move (newBranchName string , force bool , signature * Signature , msg string ) (* Branch , error ) {
135
136
var ptr * C.git_reference
136
137
cNewBranchName := C .CString (newBranchName )
138
+ defer C .free (unsafe .Pointer (cNewBranchName ))
137
139
cForce := cbool (force )
138
140
139
141
cSignature , err := signature .toC ()
@@ -180,6 +182,7 @@ func (repo *Repository) LookupBranch(branchName string, bt BranchType) (*Branch,
180
182
var ptr * C.git_reference
181
183
182
184
cName := C .CString (branchName )
185
+ defer C .free (unsafe .Pointer (cName ))
183
186
184
187
runtime .LockOSThread ()
185
188
defer runtime .UnlockOSThread ()
@@ -208,6 +211,7 @@ func (b *Branch) Name() (string, error) {
208
211
209
212
func (repo * Repository ) RemoteName (canonicalBranchName string ) (string , error ) {
210
213
cName := C .CString (canonicalBranchName )
214
+ defer C .free (unsafe .Pointer (cName ))
211
215
212
216
nameBuf := C.git_buf {}
213
217
@@ -225,6 +229,7 @@ func (repo *Repository) RemoteName(canonicalBranchName string) (string, error) {
225
229
226
230
func (b * Branch ) SetUpstream (upstreamName string ) error {
227
231
cName := C .CString (upstreamName )
232
+ defer C .free (unsafe .Pointer (cName ))
228
233
229
234
runtime .LockOSThread ()
230
235
defer runtime .UnlockOSThread ()
@@ -251,6 +256,7 @@ func (b *Branch) Upstream() (*Reference, error) {
251
256
252
257
func (repo * Repository ) UpstreamName (canonicalBranchName string ) (string , error ) {
253
258
cName := C .CString (canonicalBranchName )
259
+ defer C .free (unsafe .Pointer (cName ))
254
260
255
261
nameBuf := C.git_buf {}
256
262
0 commit comments