2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

ovsdb-client: Fix memory leak reported by valgrind.

test case 1427: ovsdb-server combines updates on backlogged connections.
    ovsdb_column_set_add (column.c:233)
    add_column (ovsdb-client.c:730)
    parse_monitor_columns (ovsdb-client.c:787)
    add_monitored_table (ovsdb-client.c:872)
    do_monitor__ (ovsdb-client.c:945)

Reported-by: William Tu <u9012063@gmail.com>
Reported-at: http://openvswitch.org/pipermail/dev/2016-January/064161.html
Signed-off-by: Andy Zhou <azhou@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
William Tu
2016-01-07 15:53:08 -08:00
committed by Ben Pfaff
parent 9547cc66f5
commit 12f554b0db

View File

@@ -878,6 +878,19 @@ add_monitored_table(int argc, char *argv[],
json_object_put(monitor_requests, table->name, monitor_request_array); json_object_put(monitor_requests, table->name, monitor_request_array);
} }
static void
destroy_monitored_table(struct monitored_table *mts, size_t n)
{
int i;
for (i = 0; i < n; i++) {
struct monitored_table *mt = &mts[i];
ovsdb_column_set_destroy(&mt->columns);
}
free(mts);
}
static void static void
do_monitor__(struct jsonrpc *rpc, const char *database, do_monitor__(struct jsonrpc *rpc, const char *database,
enum ovsdb_monitor_version version, enum ovsdb_monitor_version version,
@@ -1025,6 +1038,7 @@ do_monitor__(struct jsonrpc *rpc, const char *database,
poll_block(); poll_block();
} }
ovsdb_schema_destroy(schema); ovsdb_schema_destroy(schema);
destroy_monitored_table(mts, n_mts);
} }
static void static void