mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
learn: Fix memory leak in learn_parse_sepc()
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> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
10
lib/learn.c
10
lib/learn.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
|
||||
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -237,10 +237,12 @@ learn_parse_spec(const char *orig, char *name, char *value,
|
||||
{
|
||||
/* Parse destination and check prerequisites. */
|
||||
struct mf_subfield dst;
|
||||
char *error;
|
||||
|
||||
error = mf_parse_subfield(&dst, name);
|
||||
if (!error) {
|
||||
char *error = mf_parse_subfield(&dst, name);
|
||||
bool parse_error = error != NULL;
|
||||
free(error);
|
||||
|
||||
if (!parse_error) {
|
||||
if (!mf_nxm_header(dst.field->id)) {
|
||||
return xasprintf("%s: experimenter OXM field '%s' not supported",
|
||||
orig, name);
|
||||
|
Reference in New Issue
Block a user