[ovs-dev] [PATCH v2 ovn] logical-fields: fix memory leak caused by initialize ovnfield_by_name twice

Numan Siddique numans at ovn.org
Tue Mar 10 13:02:30 UTC 2020


On Sat, Mar 7, 2020 at 4:42 AM Ben Pfaff <blp at ovn.org> wrote:
>
> On Thu, Mar 05, 2020 at 07:21:41AM +0100, Damijan Skvarc wrote:
> > ovnfield_by_name is hash of strings which is used to quickly find
> > field by name. This hash is initialized from ovn_init_symtab(). In case
> > the latter function is called multiple times then also ovnfield_by_name is
> > initialized multiple times but without freeing previously allocated
> > memory resources what cause memory leaks.  This actually happens in
> > ovn-controller which calls ovn_init_symtab() function twice, once from
> > ofctrl.c and the other time from lflow.c files.
>
> Applied to master, thanks!

Hi Ben, Damijan,

I applied this patch to branch-20.03 as well for the following reasons
   - This patch fixes memory leak
   - branch-20.03 compilation is broken when configured with the flag
'--enable-sparse'
     Strangely, it used to compile for me last week. Even travis CI
passed for the latest commit in branch-20.03.
     I may have updated my sparse version. I'm using sparse 0.6.1 now.
    Applying this patch resolves the compilation issue.

    I'm seeing the below compilation error
   *****
   libtool: compile:  env REAL_CC=gcc "CHECK=sparse -Wsparse-error -I
/home/nusiddiq/workspace_cpp/ovn_fdp/ovn2.13/ovn/openvswitch-2.13.0/include/sparse
-m64 -I /usr/local/include  " cgcc -target=x86_64 -DHAVE_CONFIG_H -I.
-I ./include -I ./include -I ./ovn -I ./include -I
/home/nusiddiq/workspace_cpp/ovn_fdp/ovn2.13/ovn/openvswitch-2.13.0/include
-I /home/nusiddiq/workspace_cpp/ovn_fdp/ovn2.13/ovn/openvswitch-2.13.0/include
-I /home/nusiddiq/workspace_cpp/ovn_fdp/ovn2.13/ovn/openvswitch-2.13.0/lib
-I /home/nusiddiq/workspace_cpp/ovn_fdp/ovn2.13/ovn/openvswitch-2.13.0/lib
-I /home/nusiddiq/workspace_cpp/ovn_fdp/ovn2.13/ovn/openvswitch-2.13.0
-I /home/nusiddiq/workspace_cpp/ovn_fdp/ovn2.13/ovn/openvswitch-2.13.0
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare
-Wpointer-arith -Wformat -Wformat-security -Wswitch-enum
-Wunused-parameter -Wbad-function-cast -Wcast-align
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes
-Wmissing-field-initializers -fno-strict-aliasing -Wswitch-bool
-Wlogical-not-parentheses -Wsizeof-array-argument -Wbool-compare
-Wshift-negative-value -Wduplicated-cond -Wshadow
-Wmultistatement-macros -Wcast-align=strict -Werror -Werror -g -O2 -MT
lib/logical-fields.lo -MD -MP -MF lib/.deps/logical-fields.Tpo -c
lib/logical-fields.c -o lib/logical-fields.o
lib/logical-fields.c:294:1: error: symbol 'ovn_destroy_ovnfields' was
not declared. Should it be static?
make[1]: *** [Makefile:2070: lib/logical-fields.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
   ***

Thanks
Numan


> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list