Re: [PATCH v1 03/19] split-index: add {add,remove}_split_index() functions
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Oct 25, 2016, 09:58 UTC
- Message-ID
- <CACsJy8DPt3EJoSTVEZFbH6xXbh78MbLZ4h+50K4eoFxPYSaN=Q@mail.gmail.com>
- In-Reply-To
- <20161023092648.12086-4-chriscool@tuxfamily.org>
On Sun, Oct 23, 2016 at 4:26 PM, Christian Couder <christian.couder@gmail.com> wrote:
Show 8 quoted lines
> +void remove_split_index(struct index_state *istate)
> +{
> + if (istate->split_index) {
> + /*
> + * can't discard_split_index(&the_index); because that
> + * will destroy split_index->base->cache[], which may
> + * be shared with the_index.cache[]. So yeah we're
> + * leaking a bit here.In the context of update-index, this is a one-time thing and leaking is tolerable. But because it becomes a library function now, this leak can become more serious, I think.
The only other (indirect) caller is read_index_from() so probably not bad most of the time (we read at the beginning of a command only). sequencer.c may discard and re-read the index many times though, leaking could be visible there.
Show 5 quoted lines
> + */ > + istate->split_index = NULL; > + istate->cache_changed |= SOMETHING_CHANGED; > + } > +}
-- Duy