Re: [PATCH] net: microchip: vcap api: Fix memory leaks in vcap_api_encode_rule_test()

From: Daniel Machon
Date: Sun Oct 13 2024 - 05:55:47 EST


> >
> > Wait, should vcap_del_rule not handle the freeing of the rule?
> > Maybe Emil can shed some light on this..
> >
> > /Daniel
> >
>
> No, this is a bug. I made the mistake of thinking that vcap_del_rule freed the
> rule.
>
> However, it frees an internal copy of the rule, which is made in vcap_add_rule.
> The local copy must still be freed. I reproduced the leak and the patch fixes
> this.
>
> /Emil

Ah, right. Thanks for clarifying!

/Daniel