diff mbox

[ovs-dev,1/2] ovs-router: fix memory leak reported by valgrind.

Message ID CABKoBm2SB7Cr5cU_hnrh1pTVyfBVgduJFEiuxLtrdEQq_vv9hA@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Andy Zhou Feb. 8, 2017, 7:33 a.m. UTC
On Tue, Feb 7, 2017 at 10:41 PM, William Tu <u9012063@gmail.com> wrote:
> Valgrind testcase 772: appctl - route/lookup6 reports the
> following definitely lost:
>   xmalloc (util.c:112)
>   miniflow_alloc (flow.c:2500)
>   minimatch_init (match.c:1387)
>   rt_entry_delete (ovs-router.c:274)
>   ovs_router_del (ovs-router.c:384)
>   process_command (unixctl.c:313)
>
> Signed-off-by: William Tu <u9012063@gmail.com>
> ---
>  lib/ovs-router.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index d98de20..53fb834 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -280,6 +280,7 @@ rt_entry_delete(uint32_t mark, uint8_t priority,
>          res = __rt_entry_delete(cr);
>          ovs_mutex_unlock(&mutex);
>      }
> +    minimatch_destroy(CONST_CAST(struct minimatch *, &rule.match));
>      return res;
>  }
>

Acked-by: Andy Zhou <azhou@ovn.org>,

May be this can be easier to read?

dev@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Comments

William Tu Feb. 8, 2017, 2:22 p.m. UTC | #1
yes, thanks.
I will introduce cls_rule_destroy() and free the minimatch inside.
--William

On Tue, Feb 7, 2017 at 11:33 PM, Andy Zhou <azhou@ovn.org> wrote:
> On Tue, Feb 7, 2017 at 10:41 PM, William Tu <u9012063@gmail.com> wrote:
>> Valgrind testcase 772: appctl - route/lookup6 reports the
>> following definitely lost:
>>   xmalloc (util.c:112)
>>   miniflow_alloc (flow.c:2500)
>>   minimatch_init (match.c:1387)
>>   rt_entry_delete (ovs-router.c:274)
>>   ovs_router_del (ovs-router.c:384)
>>   process_command (unixctl.c:313)
>>
>> Signed-off-by: William Tu <u9012063@gmail.com>
>> ---
>>  lib/ovs-router.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
>> index d98de20..53fb834 100644
>> --- a/lib/ovs-router.c
>> +++ b/lib/ovs-router.c
>> @@ -280,6 +280,7 @@ rt_entry_delete(uint32_t mark, uint8_t priority,
>>          res = __rt_entry_delete(cr);
>>          ovs_mutex_unlock(&mutex);
>>      }
>> +    minimatch_destroy(CONST_CAST(struct minimatch *, &rule.match));
>>      return res;
>>  }
>>
>
> Acked-by: Andy Zhou <azhou@ovn.org>,
>
> May be this can be easier to read?
>
> diff --git a/lib/ovs-router.c b/lib/ovs-router.c
> index d98de20..794fdde 100644
> --- a/lib/ovs-router.c
> +++ b/lib/ovs-router.c
> @@ -280,6 +280,9 @@ rt_entry_delete(uint32_t mark, uint8_t priority,
>          res = __rt_entry_delete(cr);
>          ovs_mutex_unlock(&mutex);
>      }
> +
> +    cls_rule_destroy(&rule);
>      return res;
>  }
diff mbox

Patch

diff --git a/lib/ovs-router.c b/lib/ovs-router.c
index d98de20..794fdde 100644
--- a/lib/ovs-router.c
+++ b/lib/ovs-router.c
@@ -280,6 +280,9 @@  rt_entry_delete(uint32_t mark, uint8_t priority,
         res = __rt_entry_delete(cr);
         ovs_mutex_unlock(&mutex);
     }
+
+    cls_rule_destroy(&rule);
     return res;
 }
_______________________________________________
dev mailing list