diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-07-25 09:03:24 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-07-25 10:13:37 -0700 |
| commit | dcef3bf041c949061878803d3b7c7f7e2373b413 (patch) | |
| tree | 393a0355bcc6f0feb8dd9534b012e435da22a71f /contrib/persistent-https | |
| parent | 94f057755b7941b321fd11fec1b2e3ca5313a4e0 (diff) | |
remote: plug memory leaks
The in-core data structure used to keep track of
'url.<real>.{insteadOf,pushInsteadOf} = <alias>' settings is not
properly cleaned up when the process is done with it.
'struct rewrites' is embedded in 'remote_state' and serves as the
top level of the rewrite data. This holds an array of a variable
number of pointers to 'struct rewrite' allocated individually on the
heap. Each 'struct rewrite' holds a '.base' string and an array of
'struct counted_string' called '.instead_of', which is allocated
contiguously on the heap. Each 'struct counted_string' has a
pointer to a string allocated on the heap.
Amid these pointers, rewrites_release() fails to free everything
other than 'struct rewrite''s '.base' member and the 'struct rewrite'
instances themselves.
Fix rewrites_release() to also free the contiguous array storing
'.instead_of', the string pointers within each '.instead_of' element,
and each 'struct rewrite' instance individually allocated on the heap.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
