On Mon, Feb 5, 2018 at 8:07 PM, Eric Sunshine <sunsh...@sunshineco.com> wrote:
> On Mon, Feb 5, 2018 at 6:55 PM, Stefan Beller <sbel...@google.com> wrote:
>> Grafts are only meaningful in the context of a single repository.
>> Therefore they cannot be global.
>>
>> Signed-off-by: Stefan Beller <sbel...@google.com>
>> Signed-off-by: Jonathan Nieder <jrnie...@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

Reply via email to