[ovs-dev] [PATCH] vtep-ctl: coverity - free error string before return from cmd_remove
Ben Pfaff
blp at nicira.com
Wed Aug 27 15:05:34 UTC 2014
On Tue, Aug 26, 2014 at 06:16:12PM -0700, Madhu Challa wrote:
> error string should be freed in all cases.
>
> Signed-off-by: Madhu Challa <challa at noironetworks.com>
This patch was wordwrapped so I applied it by hand.
The "if" isn't necessary so I removed it.
I adjusted the commit message to primarily describe the change and the
reason for it and only secondarily to mention the tool.
So, applied as:
--8<--------------------------cut here-------------------------->8--
From: Madhu Challa <challa at noironetworks.com>
Date: Tue, 26 Aug 2014 18:16:12 -0700
Subject: [PATCH] vtep-ctl: Free error string before return from cmd_remove().
Error string should be freed in all cases.
Found by Coverity.
Signed-off-by: Madhu Challa <challa at noironetworks.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
vtep/vtep-ctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index 0b9463a..3576313 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2010, 2011, 2012, 2014 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);
}
--
1.9.1
More information about the dev
mailing list