Re: [PATCH 092/194] object: move grafts to object parser
- From
Stefan Beller <sbeller@google.com>
- Date
- Feb 6, 2018, 18:04 UTC
- Message-ID
- <CAGZ79kYKJYemWaaco5wMexf8eiYSDZ06YuReBFykFypSMQNzEQ@mail.gmail.com>
- In-Reply-To
- <CAPig+cT4=WA2PpovtG1M5hsrTxzDYdGjiYgvpp4Pbggc3Qo-Yw@mail.gmail.com>
On Mon, Feb 5, 2018 at 8:07 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 29 quoted lines
> On Mon, Feb 5, 2018 at 6:55 PM, Stefan Beller <sbeller@google.com> wrote:
>> Grafts are only meaningful in the context of a single repository.
>> Therefore they cannot be global.
>>
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
>> ---
>> diff --git a/commit.c b/commit.c
>> @@ -121,20 +120,22 @@ int register_commit_graft(struct commit_graft *graft, int ignore_dups)
>> if (ignore_dups)
>> free(graft);
>> else {
>> - free(commit_graft[pos]);
>> - commit_graft[pos] = graft;
>> + free(the_repository->parsed_objects.grafts[pos]);
>> + the_repository->parsed_objects.grafts[pos] = graft;
>> diff --git a/object.h b/object.h
>> @@ -4,9 +4,13 @@
>> struct object_parser {
>> struct object **obj_hash;
>> int nr_objs, obj_hash_size;
>> +
>> + /* parent substitutions from .git/info/grafts and .git/shallow */
>> + struct commit_graft **grafts;
>> + int grafts_alloc, grafts_nr;
>> };
>
> Do items moved to object_parser need to get freed when object_parser
> itself is freed? Is that happening in some other patch?No, this patch supposedly should free the memory via repo_free (which either does it itself or calls some specific free for the grafts)
Thanks for finding the mem leak! Stefan