Re: [PATCH v4 4/4] commit: rewrite read_graft_line
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 18, 2017, 19:12 UTC
- Message-ID
- <xmqqlgmgbshg.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAJfL8+T3vqnmFJmx19H-v8yGiY4Se78SM+ax_q07_PF4VHDv3Q@mail.gmail.com>
Patryk Obara <patryk.obara@gmail.com> writes:
> Actually, I don't think I needed to remove free(graft) line, but I don't > know if freeing NULL is considered ok in git code. Let me know if I > should bring it back, please.
Calling free(var) when var may or may not be NULL is perfectly fine.
We even discourage people from writing:
if (var) free(var);
because an unconditional call to free(var) is sufficient.