mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 07:15:17 +00:00
ovs-ofctl: Fix memory leak reported by valgrind.
Reported by 348: ovs-ofctl parse-flows (skb_priority) Reason: return without freeing memory Signed-off-by: William Tu <u9012063@gmail.com> Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com> Co-authored-by: Daniele Di Proietto <diproiettod@vmware.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -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,
|
error = parse_ofp_flow_mod_str(&(*fms)[*n_fms], ds_cstr(&s), command,
|
||||||
&usable);
|
&usable);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
char *err_msg;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < *n_fms; 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);
|
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. */
|
*usable_protocols &= usable; /* Each line can narrow the set. */
|
||||||
*n_fms += 1;
|
*n_fms += 1;
|
||||||
|
Reference in New Issue
Block a user