Re: [PATCHv2 3/4] bundle: don't leak an fd in case of early return
- From
Stefan Beller <sbeller@google.com>
- Date
- Mar 31, 2016, 17:47 UTC
- Message-ID
- <CAGZ79kYFr8bjEhV9sDzR1KbqAVrO89-DRBN2u+zQBwVYViDP9w@mail.gmail.com>
- In-Reply-To
- <CAPig+cSE5wVNNwiwkYoOXnfDKUO3tBKqUUbqBHPCTA5ibj-kNg@mail.gmail.com>
On Wed, Mar 30, 2016 at 10:41 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 7 quoted lines
>> - else if (ref_count < 0)
>> - return -1;
>> + else if (ref_count < 0) {
>> + if (!bundle_to_stdout)
>> + close(bundle_fd);
>
> Why is this close() here considering that it gets closed by the 'err' path?Thanks for pointing out; fixed in a reroll.