On 5/13/20 2:56 PM, Ilya Maximets wrote:
> 'sset_array' allocates new array that must be freed by the caller:
>
> 640 bytes in 40 blocks are definitely lost in loss record 73 of 74
> at 0x483980B: malloc (vg_replace_malloc.c:309)
> by 0x4B4B94: xmalloc (util.c:138)
> by 0x4AEA03: sset_array (sset.c:344)
> by 0x424210: ovn_update_ipv6_prefix (ovn-northd.c:2726)
> by 0x424210: ovnnb_db_run (ovn-northd.c:11148)
> by 0x424210: ovn_db_run (ovn-northd.c:11692)
> by 0x408C78: main (ovn-northd.c:12055)
>
> 'sset' used here to store only one string, so it's not really needed.
> Removing the 'ipv6_prefix_set' to simplify the code and avoid memory
> leak. New variable introduced to avoid casting issues with sparse
> and -Wcast-align.
>
> Fixes: 5c1d2d230773 ("northd: Add logical flows for dhcpv6 pfd parsing")
> Signed-off-by: Ilya Maximets <[email protected]>
> ---
> northd/ovn-northd.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index b25152d74..aebc72152 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -2721,12 +2721,8 @@ ovn_update_ipv6_prefix(struct hmap *ports)
> continue;
> }
>
> - struct sset ipv6_prefix_set = SSET_INITIALIZER(&ipv6_prefix_set);
> - sset_add(&ipv6_prefix_set, prefix);
> - nbrec_logical_router_port_set_ipv6_prefix(op->nbrp,
> - sset_array(&ipv6_prefix_set),
> - sset_count(&ipv6_prefix_set));
> - sset_destroy(&ipv6_prefix_set);
> + const char *prefix_ptr = prefix;
> + nbrec_logical_router_port_set_ipv6_prefix(op->nbrp, &prefix_ptr, 1);
> }
> }
>
>
Looks good to me, thanks!
Acked-by: Dumitru Ceara <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev