[ovs-dev] [PATCH 1/1] ovn-northd: fixed memory leak in ovn_port_update_sbrec()

Numan Siddique nusiddiq at redhat.com
Fri Aug 2 16:13:53 UTC 2019


On Fri, Aug 2, 2019 at 5:45 PM Damijan Skvarc <damjan.skvarc at gmail.com>
wrote:

> Memory leak happens because of redundand memory allocation for array
> of single pointer. Issue was solved by removing this redundand allocation
> and using address of pointer to created chassis sb_ha_entity instead.
>
> Signed-off-by: Damijan Skvarc <damjan.skvarc at gmail.com>
>

Acked-by: Numan Siddique <nusiddiq at redhat.com>



> ---
>  northd/ovn-northd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> index cd776fa..d99ae67 100644
> --- a/northd/ovn-northd.c
> +++ b/northd/ovn-northd.c
> @@ -2506,12 +2506,10 @@ ovn_port_update_sbrec(struct northd_context *ctx,
>                      }
>
>                      if (sb_ha_ch_grp->n_ha_chassis != 1) {
> -                        struct sbrec_ha_chassis **sb_ha_ch =
> -                            xcalloc(1, sizeof *sb_ha_ch);
> -                        sb_ha_ch[0] = create_sb_ha_chassis(ctx, chassis,
> +                        struct sbrec_ha_chassis *sb_ha_ch =
> create_sb_ha_chassis(ctx, chassis,
>                                                             chassis->name,
> 0);
>
>  sbrec_ha_chassis_group_set_ha_chassis(sb_ha_ch_grp,
> -                                                              sb_ha_ch,
> 1);
> +                                                              &sb_ha_ch,
> 1);
>                      }
>                      sbrec_port_binding_set_ha_chassis_group(op->sb,
>                                                              sb_ha_ch_grp);
> --
> 2.7.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list