[ovs-dev] [PATCH 1/4] ovsdb-client: fix memory leak reported by valgrind

Ben Pfaff blp at ovn.org
Mon Jan 4 20:31:50 UTC 2016


On Thu, Dec 24, 2015 at 10:28:39AM -0800, William Tu wrote:
> Free memory allocated from table_add_column and table_add_row. Call
> stack is below:
>     xrealloc (util.c:123)
>     table_add_column (table.c:146) or table_add_row (table.c:172)
>     do_list_tables (ovsdb-client.c:449)
>     main (ovsdb-client.c:151)
> 
> Signed-off-by: William Tu <u9012063 at gmail.com>
> Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
> Co-authored-by: Daniele Di Proietto <diproiettod at vmware.com>

Clang reports the following, and I think it's right:

../ovsdb/ovsdb-client.c:137:18: error: variable 'database' is uninitialized when
      used here [-Werror,-Wuninitialized]
            free(database);
                 ^~~~~~~~
../ovsdb/ovsdb-client.c:87:19: note: initialize the variable 'database' to
      silence this warning
    char *database;
                  ^
                   = NULL



More information about the dev mailing list