Re: [PATCH v5 12/24] refs.c: kill register_ref_store(), add register_submodule_ref_store()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 1, 2017 at 1:03 AM, Michael Haggerty <mhagger@xxxxxxxxxxxx> wrote:
>>  struct ref_store *get_ref_store(const char *submodule)
>>  {
>>       struct strbuf submodule_sb = STRBUF_INIT;
>> @@ -1480,6 +1479,9 @@ struct ref_store *get_ref_store(const char *submodule)
>>       if (is_nonbare_repository_dir(&submodule_sb))
>>               refs = ref_store_init(submodule);
>>       strbuf_release(&submodule_sb);
>> +
>> +     if (refs)
>
> I think `refs` should always be non-NULL here for the same reason.

That's true if is_nonbar_repo... returns true. If it's false (e.g.
uninitialized submodule) then refs remains NULL from before (I didn't
know about this until I hit a segfault in rev-list in another series)
-- 
Duy



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]