[ovs-dev] [PATCH] bridge: Fix custom stats' counters leak.

Ilya Maximets i.maximets at samsung.com
Tue Jan 23 05:53:57 UTC 2018


On 22.01.2018 20:01, Mark Michelson wrote:
> On 01/22/2018 09:50 AM, Ilya Maximets wrote:
>> The caller takes ownership over allocated array of counters.
>> And it must free them.
>>
>> CC: Michal Weglicki <michalx.weglicki at intel.com>
>> Fixes: 971f4b394c6e ("netdev: Custom statistics.")
>> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
>> ---
>>   vswitchd/bridge.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
>> index d80da1c..02d97de 100644
>> --- a/vswitchd/bridge.c
>> +++ b/vswitchd/bridge.c
>> @@ -2432,6 +2432,7 @@ iface_refresh_stats(struct iface *iface)
>>         free(values);
>>       free(keys);
>> +    free(custom_stats.counters);
> 
> The sentiment is correct here, but I believe that rather than freeing custom_stats.counters directly, you should call
> netdev_free_custom_stats_counters(&custom_stats);

Sure. Thanks for pointing this.

Best regards, Ilya Maximets.

> 
> 
>>   }
>>     static void
>>
> 
> 
> 
> 


More information about the dev mailing list