Reported by Coverity.
  overwrite_var: Overwriting "config_file_path" in
  "config_file_path = abs_file_name(ovs_dbdir(), optarg)"
  leaks the storage that "config_file_path" points to.
  Make sure any existing config_file_path is freed before
  overwriting.

Signed-off-by: Roi Dayan <[email protected]>
Acked-by: Eli Britstein <[email protected]>
---
 ovsdb/ovsdb-server.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index a247ae8f0ae0..a874a2130d47 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -2747,8 +2747,10 @@ parse_options(int argc, char *argv[],
             break;
 
         case OPT_CONFIG_FILE:
-            config_file_path = abs_file_name(ovs_dbdir(), optarg);
-            add_default_db = false;
+            if (!config_file_path) {
+                config_file_path = abs_file_name(ovs_dbdir(), optarg);
+                add_default_db = false;
+            }
             break;
 
         case '?':
-- 
2.47.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to