If there is an error after ovsdb_rbac_insert, 'row' is leaked.
So move the existing ovsdb_row_destroy to the function end.

Signed-off-by: Yifeng Sun <pkusunyif...@gmail.com>
---
 ovsdb/execution.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ovsdb/execution.c b/ovsdb/execution.c
index 1ebe7a772e47..016b9c68767c 100644
--- a/ovsdb/execution.c
+++ b/ovsdb/execution.c
@@ -348,7 +348,6 @@ ovsdb_execute_insert(struct ovsdb_execution *x, struct 
ovsdb_parser *parser,
             if (datum->n == 1) {
                 error = ovsdb_datum_check_constraints(datum, &column->type);
                 if (error) {
-                    ovsdb_row_destroy(row);
                     break;
                 }
             }
@@ -367,6 +366,8 @@ ovsdb_execute_insert(struct ovsdb_execution *x, struct 
ovsdb_parser *parser,
         json_object_put(result, "uuid",
                         ovsdb_datum_to_json(&row->fields[OVSDB_COL_UUID],
                                             &ovsdb_type_uuid));
+    } else {
+        ovsdb_row_destroy(row);
     }
     return error;
 }
-- 
2.7.4

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to