git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v7 01/11] dir: free untracked cache when removing it

From
Christian Couder <christian.couder@gmail.com>
Date
Jan 26, 2016, 06:48 UTC
Message-ID
<CAP8UFD2vkErMGpdBZU78PFGO71Jk8sq+TfBNAtOp0=REsv_N0g@mail.gmail.com>
In-Reply-To
<CAGZ79kYoQFWQCxpGxze=v36PTrC7+EgVOwtfm0kgE_kQoekq1g@mail.gmail.com>
On Mon, Jan 25, 2016 at 8:16 PM, Stefan Beller <sbeller@google.com> wrote:
Show 20 quoted lines
> On Sun, Jan 24, 2016 at 7:28 AM, Christian Couder
> <christian.couder@gmail.com> wrote:
>> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
>> ---
>>  builtin/update-index.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/builtin/update-index.c b/builtin/update-index.c
>> index 7431938..a6fff87 100644
>> --- a/builtin/update-index.c
>> +++ b/builtin/update-index.c
>> @@ -1123,6 +1123,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
>>                 add_untracked_ident(the_index.untracked);
>>                 the_index.cache_changed |= UNTRACKED_CHANGED;
>>         } else if (!untracked_cache && the_index.untracked) {
>> +               free_untracked_cache(the_index.untracked);
>
> Do we need to free its members, too? (Or is it empty enough here,
> that there are no memleaks in there? If this were the case a hint in
> the commit message would be helpful)

free_untracked_cache() takes care of freeing the members of the struct it is passed. If it doesn't free them all it's probably a bug. Many free_*() functions in the Git code base do the same thing. And yeah I think it is safer to free everything.

Previous: Stefan BellerNext: Christian Couder
Message 4 of 16 in “Untracked cache improvements”
  1. 00/11 Untracked cache improvementsChristian Couder, Jan 24, 2016
  2. 01/11 dir: free untracked cache when removing itChristian Couder, Jan 24, 2016
  3. Stefan BellerJan 25, 2016
  4. Christian CouderJan 26, 2016
  5. 02/11 update-index: use enum for untracked cache optionsChristian Couder, Jan 24, 2016
  6. 03/11 update-index: add --test-untracked-cacheChristian Couder, Jan 24, 2016
  7. 04/11 update-index: add untracked cache notificationsChristian Couder, Jan 24, 2016
  8. 05/11 update-index: move 'uc' var declarationChristian Couder, Jan 24, 2016
  9. 06/11 dir: add {new,add}_untracked_cache()Christian Couder, Jan 24, 2016
  10. 07/11 dir: add remove_untracked_cache()Christian Couder, Jan 24, 2016
  11. 08/11 dir: simplify untracked cache "ident" fieldChristian Couder, Jan 24, 2016
  12. 09/11 config: add core.untrackedCacheChristian Couder, Jan 24, 2016
  13. Junio C HamanoJan 25, 2016
  14. Christian CouderJan 26, 2016
  15. 10/11 test-dump-untracked-cache: don't modify the untracked cacheChristian Couder, Jan 24, 2016
  16. 11/11 t7063: add tests for core.untrackedCacheChristian Couder, Jan 24, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.