netdev-dpdk: fix mbuf leaks
[cascardo/ovs.git] / ovsdb / ovsdb-client.c
index 9a6f3e9..980cd9a 100644 (file)
@@ -145,6 +145,7 @@ main(int argc, char *argv[])
 
     if (argc - optind < command->min_args ||
         argc - optind > command->max_args) {
+        free(database);
         VLOG_FATAL("invalid syntax for '%s' (use --help for help)",
                     command->name);
     }
@@ -878,6 +879,19 @@ add_monitored_table(int argc, char *argv[],
     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
 do_monitor__(struct jsonrpc *rpc, const char *database,
              enum ovsdb_monitor_version version,
@@ -1024,7 +1038,11 @@ do_monitor__(struct jsonrpc *rpc, const char *database,
         unixctl_server_wait(unixctl);
         poll_block();
     }
+
+    json_destroy(request_id);
+    unixctl_server_destroy(unixctl);
     ovsdb_schema_destroy(schema);
+    destroy_monitored_table(mts, n_mts);
 }
 
 static void