Re: [PATCH v2 01/12] sha1_file: do not leak `lock_file`

2017-10-05 Thread Junio C Hamano
Martin Ågren writes: > Bump `found` to the scope of the whole function and rearrange the "roll > back or write?"-checks to a straightforward if-else on `found`. This > also future-proves the code by making it obvious that we intend to take > exactly one of these paths. >

[PATCH v2 01/12] sha1_file: do not leak `lock_file`

2017-10-05 Thread Martin Ågren
There is no longer any need to allocate and leak a `struct lock_file`. Initialize it on the stack instead. Before this patch, we set `lock = NULL` to signal that we have already rolled back, and that we should not do any more work. We need to take another approach now that we cannot assign NULL.