[ovs-dev] [PATCH] ovs-vsctl: Fix unitialized variables.

Jesse Gross jesse at nicira.com
Fri Jul 16 01:08:17 UTC 2010


The compiler pointed out two variables that it thought were used
without being initialized.  The first was just a spurious warning
but the second could result in an unitialized pointer being freed.
This fixes both of those issues.
---
 utilities/ovs-vsctl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index d9d3b63..90309cc 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -2675,7 +2675,7 @@ is_condition_satified(const struct vsctl_table_class *table,
     const char *operator;
     unsigned int idx;
     char *error;
-    int cmp;
+    int cmp = 0;
 
     error = parse_column_key_value(arg, table, &column, &key_string,
                                    &operator, operators, ARRAY_SIZE(operators),
@@ -2808,7 +2808,7 @@ do_vsctl(const char *args, struct vsctl_command *commands, size_t n_commands,
     const char *unused;
     struct vsctl_command *c;
     int64_t next_cfg = 0;
-    char *error;
+    char *error = NULL;
 
     txn = the_idl_txn = ovsdb_idl_txn_create(idl);
     if (dry_run) {
-- 
1.7.0.4





More information about the dev mailing list