diff options
author | Stefan Beller <sbeller@google.com> | 2015-03-23 10:57:11 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-23 11:12:59 -0700 |
commit | 915e44c6357f3bd9d5fa498a201872c4367302d3 (patch) | |
tree | 5a266853f74dff3c34666f005719bd34bb423a35 /ewah | |
parent | add_to_index(): free unused cache-entry (diff) | |
download | tgif-915e44c6357f3bd9d5fa498a201872c4367302d3.tar.xz |
read-cache: fix memleak
`ce` is allocated in make_cache_entry and should be freed if it is not
used any more. refresh_cache_entry as a wrapper around refresh_cache_ent
will either return
- the `ce` given as the parameter, when it was up-to-date;
- a new updated cache entry which is allocated to new memory; or
- a NULL when refreshing failed.
In the latter two cases, the original cache-entry `ce` is not used
and needs to be freed. The rule can be expressed as "if the return
value from refresh is different from the original ce, ce is no
longer used."
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ewah')
0 files changed, 0 insertions, 0 deletions