[ovs-dev] [PATCH] vtep-ctl: coverity - free error string before return from cmd_remove

Madhu Challa challa at noironetworks.com
Wed Aug 27 01:16:12 UTC 2014


error string should be freed in all cases.

Signed-off-by: Madhu Challa <challa at noironetworks.com>
---
 vtep/vtep-ctl.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index 0b9463a..064ad1f 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -3199,11 +3199,13 @@ cmd_remove(struct vtep_ctl_context *ctx)
         error = ovsdb_datum_from_string(&rm, &rm_type,
                                         ctx->argv[i], ctx->symtab);
         if (error && ovsdb_type_is_map(&rm_type)) {
-            free(error);
             rm_type.value.type = OVSDB_TYPE_VOID;
             die_if_error(ovsdb_datum_from_string(&rm, &rm_type,
                                                  ctx->argv[i],
ctx->symtab));
         }
+        if (error) {
+            free(error);
+        }
         ovsdb_datum_subtract(&old, type, &rm, &rm_type);
         ovsdb_datum_destroy(&rm, &rm_type);
     }
--
1.7.9.5



More information about the dev mailing list