[ovs-dev] [PATCH v2] ovsdb-server: fix memory leak while converting database

Damijan Skvarc damjan.skvarc at gmail.com
Fri Oct 25 12:22:58 UTC 2019


Hi Ben & thanks for looking into this.

I can confirm your suggestion works ok and prevents freeing the same
memory twice. Thanks for finding this possibility. Otherwise I would do
this in some other way, but not all people are the same :).

Signed-off-by: Damijan Skvarc <damjan.skvarc at gmail.com>
---
 ovsdb/file.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ovsdb/file.c b/ovsdb/file.c
index 8d16b09..0af077f 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -235,10 +235,14 @@ ovsdb_convert_table(struct ovsdb_txn *txn,
                 continue;
             }
 
+            ovsdb_datum_destroy(&dst_row->fields[dst_column->index],
+                                &dst_column->type);
+
             struct ovsdb_error *error = ovsdb_datum_convert(
                 &dst_row->fields[dst_column->index], &dst_column->type,
                 &src_row->fields[src_column->index], &src_column->type);
             if (error) {
+                ovsdb_datum_init_empty(&dst_row->fields[dst_column->index]);
                 ovsdb_row_destroy(dst_row);
                 return error;
             }
-- 
2.7.4



More information about the dev mailing list