Skip to content

Commit 12bca1b

Browse files
committed
remote: do not free the custom header ruby strings
The strings themselves are owned by the ruby runtime. We must only free the array we allocated to point to their buffers.
1 parent 88104e8 commit 12bca1b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/rugged/rugged_remote.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self)
324324
cleanup:
325325

326326
git_remote_disconnect(remote);
327-
git_strarray_free(&custom_headers);
327+
xfree(custom_headers.strings);
328328

329329
if (payload.exception)
330330
rb_jump_tag(payload.exception);
@@ -517,7 +517,7 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
517517
error = git_remote_connect(remote, direction, &callbacks, NULL, &custom_headers);
518518
git_remote_disconnect(remote);
519519

520-
git_strarray_free(&custom_headers);
520+
xfree(custom_headers.strings);
521521

522522
if (payload.exception)
523523
rb_jump_tag(payload.exception);
@@ -617,7 +617,7 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
617617
error = git_remote_fetch(remote, &refspecs, &opts, log_message);
618618

619619
xfree(refspecs.strings);
620-
git_strarray_free(&opts.custom_headers);
620+
xfree(opts.custom_headers.strings);
621621

622622
if (payload.exception)
623623
rb_jump_tag(payload.exception);
@@ -692,7 +692,7 @@ static VALUE rb_git_remote_push(int argc, VALUE *argv, VALUE self)
692692
error = git_remote_push(remote, &refspecs, &opts);
693693

694694
xfree(refspecs.strings);
695-
git_strarray_free(&opts.custom_headers);
695+
xfree(opts.custom_headers.strings);
696696

697697
if (payload.exception)
698698
rb_jump_tag(payload.exception);

0 commit comments

Comments
 (0)