[ovs-dev] ovsdb-server: Fix memory leak in update_remote_status() error path.

Submitted by Ben Pfaff on March 19, 2017, 5:22 p.m.

Details

Message ID 20170319172205.30125-1-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff March 19, 2017, 5:22 p.m.
Found by inspection.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 ovsdb/ovsdb-server.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

andy zhou March 20, 2017, 7:46 p.m.
On Sun, Mar 19, 2017 at 10:22 AM, Ben Pfaff <blp@ovn.org> wrote:
> Found by inspection.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Ben Pfaff March 29, 2017, 6:19 p.m.
On Mon, Mar 20, 2017 at 12:46:37PM -0700, Andy Zhou wrote:
> On Sun, Mar 19, 2017 at 10:22 AM, Ben Pfaff <blp@ovn.org> wrote:
> > Found by inspection.
> >
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> Acked-by: Andy Zhou <azhou@ovn.org>

Thanks, applied to master.

Patch hide | download patch | download mbox

diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 52af4d36aeb9..4f88500a054d 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -1,4 +1,4 @@ 
-/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2016 Nicira, Inc.
+/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -1076,8 +1076,9 @@  update_remote_status(const struct ovsdb_jsonrpc_server *jsonrpc,
         db = node->data;
         error = ovsdb_txn_commit(db->txn, false);
         if (error) {
-            VLOG_ERR_RL(&rl, "Failed to update remote status: %s",
-                        ovsdb_error_to_string(error));
+            char *msg = ovsdb_error_to_string(error);
+            VLOG_ERR_RL(&rl, "Failed to update remote status: %s", msg);
+            free(msg);
             ovsdb_error_destroy(error);
         }
     }