Re: [PATCH] Fix static analyzers warnings

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

 



On Sat, Dec 17, 2011 at 7:39 PM, Lucas De Marchi
<lucas.demarchi@xxxxxxxxxxxxxx> wrote:
> Hi Cristian,
>
> * Cristian Rodríguez <crrodriguez@xxxxxxxxxxxx> [2011-12-16 15:27:48 -0300]:
>
>> - Reduce the scope of i, child_count
>> - Fd leak on failure
>> - Initialize st
>> ---
>>  libkmod/libkmod-index.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/libkmod/libkmod-index.c b/libkmod/libkmod-index.c
>> index 7f0c092..c376176 100644
>> --- a/libkmod/libkmod-index.c
>> +++ b/libkmod/libkmod-index.c
>> @@ -258,7 +258,6 @@ static struct index_node_f *index_read(FILE *in, uint32_t offset)
>>  {
>>       struct index_node_f *node;
>>       char *prefix;
>> -     int i, child_count = 0;
>>
>>       if ((offset & INDEX_NODE_MASK) == 0)
>>               return NULL;
>> @@ -276,6 +275,7 @@ static struct index_node_f *index_read(FILE *in, uint32_t offset)
>>       if (offset & INDEX_NODE_CHILDS) {
>>               char first = read_char(in);
>>               char last = read_char(in);
>> +             int i, child_count = 0;
>>               child_count = last - first + 1;
>>
>>               node = NOFAIL(malloc(sizeof(struct index_node_f) +
>> @@ -343,6 +343,7 @@ struct index_file *index_file_open(const char *filename)
>>
>>       magic = read_long(file);
>>       if (magic != INDEX_MAGIC)
>> +             fclose(file);
>>               return NULL;
>
> You should enclose the if with braces.


So, I went already and applied this fix. The others remain untouched.

Thanks
Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux