@@ -322,6 +322,7 @@ learn_parse_spec(const char *orig, char *name, char *value,
char *tail;
char *dst_value = strstr(value, "->");
+ free(error);
if (dst_value == value) {
return xasprintf("%s: missing source before `->' in `%s'", name,
value);
@@ -358,6 +359,8 @@ learn_parse_spec(const char *orig, char *name, char *value,
spec->dst = move.dst;
}
} else if (!strcmp(name, "output")) {
+ free(error);
+
char *error = mf_parse_subfield(&spec->src, value);
if (error) {
return error;
@@ -367,6 +370,7 @@ learn_parse_spec(const char *orig, char *name, char *value,
spec->src_type = NX_LEARN_SRC_FIELD;
spec->dst_type = NX_LEARN_DST_OUTPUT;
} else {
+ free(error);
return xasprintf("%s: unknown keyword %s", orig, name);
}
In testcase "ofproto-dpif - fragment handling - actions", valgrind reports memeory leaks with the following call stack. xmalloc (util.c:112) xvasprintf (util.c:176) xasprintf (util.c:272) mf_parse_subfield__ (nx-match.c:1939) mf_parse_subfield (nx-match.c:1991) learn_parse_spec (learn.c:242) learn_parse__ (learn.c:436) learn_parse (learn.c:464) parse_LEARN (ofp-actions.c:4670) ofpact_parse (ofp-actions.c:8231) ofpacts_parse__ (ofp-actions.c:8278) ofpacts_parse (ofp-actions.c:8350) ofpacts_parse_copy (ofp-actions.c:8368) parse_ofp_str__ (ofp-parse.c:543) parse_ofp_str (ofp-parse.c:596) parse_ofp_flow_mod_str (ofp-parse.c:1024) ofctl_flow_mod (ovs-ofctl.c:1496) ovs_cmdl_run_command__ (command-line.c:115) main (ovs-ofctl.c:147) Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> --- lib/learn.c | 4 ++++ 1 file changed, 4 insertions(+)