[ovs-dev] [PATCH 1/3] ovs-ofctl: fix memory leak reported by valgrind
William Tu
u9012063 at gmail.com
Tue Jan 5 21:38:41 UTC 2016
Reported by 348: ovs-ofctl parse-flows (skb_priority)
Reason: return without freeing memory
Signed-off-by: William Tu <u9012063 at gmail.com>
Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
Co-authored-by: Daniele Di Proietto <diproiettod at vmware.com>
---
lib/ofp-parse.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index c346f10..aa0cad7 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -1039,6 +1039,7 @@ parse_ofp_flow_mod_file(const char *file_name, int command,
error = parse_ofp_flow_mod_str(&(*fms)[*n_fms], ds_cstr(&s), command,
&usable);
if (error) {
+ char *err_msg;
size_t i;
for (i = 0; i < *n_fms; i++) {
@@ -1053,7 +1054,9 @@ parse_ofp_flow_mod_file(const char *file_name, int command,
fclose(stream);
}
- return xasprintf("%s:%d: %s", file_name, line_number, error);
+ err_msg = xasprintf("%s:%d: %s", file_name, line_number, error);
+ free(error);
+ return err_msg;
}
*usable_protocols &= usable; /* Each line can narrow the set. */
*n_fms += 1;
--
2.5.0
More information about the dev
mailing list