Skip to content

Commit

Permalink
Do not access freed memory in test_push_options()
Browse files Browse the repository at this point in the history
Fixes #1301
  • Loading branch information
kempniu committed Jun 10, 2024
1 parent a9c7cce commit 5b27dee
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions test/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,9 @@ def test_push_options(mock_callbacks, origin, clone, remote):
remote.push(['refs/heads/master'], push_options=['foo'])
remote_push_options = mock_callbacks.return_value.push_options.remote_push_options
assert remote_push_options.count == 1
assert ffi.string(remote_push_options.strings[0]) == b'foo'
# strings pointed to by remote_push_options.strings[] are already freed

remote.push(['refs/heads/master'], push_options=['Option A', 'Option B'])
remote_push_options = mock_callbacks.return_value.push_options.remote_push_options
assert remote_push_options.count == 2
assert ffi.string(remote_push_options.strings[0]) == b'Option A'
assert ffi.string(remote_push_options.strings[1]) == b'Option B'
# strings pointed to by remote_push_options.strings[] are already freed

0 comments on commit 5b27dee

Please sign in to comment.