Commit 19a305b
committed
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.
Fix the rewrites_release() function to free not just the 'struct
rewrites' instance itself, but also allocated structures that are
pointed at by the 'struct rewrites' instance. One of the embedded
structures holds a 'const char *' to point at a borrowed constant
string from a configuration callback. Since the code does not
modify this string, stop copying the value (alias URL) before
registering it in 'struct rewrite', as nobody is freeing this
member, to avoid leaking the extra copy.
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 94f0577 commit 19a305b
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
308 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
309 | 312 | | |
310 | 313 | | |
311 | 314 | | |
| |||
464 | 467 | | |
465 | 468 | | |
466 | 469 | | |
467 | | - | |
| 470 | + | |
468 | 471 | | |
469 | 472 | | |
470 | 473 | | |
471 | 474 | | |
472 | 475 | | |
473 | | - | |
| 476 | + | |
474 | 477 | | |
475 | 478 | | |
476 | 479 | | |
| |||
0 commit comments