When options are freed, options->role need to be freed explicitly.

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

diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 030d86ba467f..cd30dd48425b 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -674,6 +674,21 @@ add_remote(struct shash *remotes, const char *target)
     return options;
 }
 
+static void
+free_remotes(struct shash *remotes)
+{
+    struct ovsdb_jsonrpc_options *options;
+    struct shash_node *node;
+
+    if (remotes) {
+        SHASH_FOR_EACH(node, remotes) {
+            options = node->data;
+            free(options->role);
+        }
+        shash_destroy_free_data(remotes);
+    }
+}
+
 /* Adds a remote and options to 'remotes', based on the Manager table row in
  * 'row'. */
 static void
@@ -929,7 +944,7 @@ reconfigure_remotes(struct ovsdb_jsonrpc_server *jsonrpc,
         }
     }
     ovsdb_jsonrpc_server_set_remotes(jsonrpc, &resolved_remotes);
-    shash_destroy_free_data(&resolved_remotes);
+    free_remotes(&resolved_remotes);
 
     return errors.string;
 }
-- 
2.7.4

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

Reply via email to