vtep-ctl: Free error string before return from cmd_remove().
authorMadhu Challa <challa@noironetworks.com>
Wed, 27 Aug 2014 01:16:12 +0000 (18:16 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 27 Aug 2014 15:05:49 +0000 (08:05 -0700)
Error string should be freed in all cases.

Found by Coverity.

Signed-off-by: Madhu Challa <challa@noironetworks.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
vtep/vtep-ctl.c

index 0b9463a..3576313 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -3199,11 +3199,11 @@ 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));
         }
+        free(error);
         ovsdb_datum_subtract(&old, type, &rm, &rm_type);
         ovsdb_datum_destroy(&rm, &rm_type);
     }