On 9/2/19 11:27 PM, Rosen Penev wrote:
> On Mon, Sep 2, 2019 at 1:29 PM Hauke Mehrtens <[email protected]> wrote:
>>
>> This fixes some resources leaks mostly in error patches.
>>
>> Coverity: #1330236, #1330237, #1330238
>> Signed-off-by: Hauke Mehrtens <[email protected]>
>> ---
>>  main.c | 12 ++++++++++--
>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/main.c b/main.c
>> index 3536443..ef47b28 100644
>> --- a/main.c
>> +++ b/main.c
>> @@ -129,6 +129,7 @@ get_file(const char *filename, char *buf, int buflen)
>>
>>         len = fread(buf, 1, buflen - 1, f);
>>         buf[len] = 0;
>> +       fclose(f);
> It's more compact to use __attribute__((cleanup)) instead. Although
> last time I tried making changes like those they were shot sown since
> it's a GNU extension.

Nice feature, I was not aware of it.

I still would use the old way because this is a GNU extension.

Hauke

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to