diff mbox series

[ovs-dev] ovsdb: Fix memory leak in corner case in ovsdb_txn_commit_().

Message ID 20171219222040.19022-1-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev] ovsdb: Fix memory leak in corner case in ovsdb_txn_commit_(). | expand

Commit Message

Ben Pfaff Dec. 19, 2017, 10:20 p.m. UTC
Reported-by: Yifeng Sun <pkusunyifeng@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 ovsdb/transaction.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Yifeng Sun Dec. 19, 2017, 10:22 p.m. UTC | #1
Thanks for the fix.

Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>


On Tue, Dec 19, 2017 at 2:20 PM, Ben Pfaff <blp@ovn.org> wrote:

> Reported-by: Yifeng Sun <pkusunyifeng@gmail.com>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  ovsdb/transaction.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
> index 2e315804a19e..f47d45fca397 100644
> --- a/ovsdb/transaction.c
> +++ b/ovsdb/transaction.c
> @@ -814,6 +814,7 @@ ovsdb_txn_commit_(struct ovsdb_txn *txn, bool durable)
>       * was really a no-op. */
>      error = for_each_txn_row(txn, determine_changes);
>      if (error) {
> +        ovsdb_txn_abort(txn);
>          return OVSDB_WRAP_BUG("can't happen", error);
>      }
>      if (ovs_list_is_empty(&txn->txn_tables)) {
> --
> 2.10.2
>
>
diff mbox series

Patch

diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
index 2e315804a19e..f47d45fca397 100644
--- a/ovsdb/transaction.c
+++ b/ovsdb/transaction.c
@@ -814,6 +814,7 @@  ovsdb_txn_commit_(struct ovsdb_txn *txn, bool durable)
      * was really a no-op. */
     error = for_each_txn_row(txn, determine_changes);
     if (error) {
+        ovsdb_txn_abort(txn);
         return OVSDB_WRAP_BUG("can't happen", error);
     }
     if (ovs_list_is_empty(&txn->txn_tables)) {