diff mbox series

[ovs-dev,2/2] ofp-flow: minimatch is initialized twice.

Message ID 1522775579-6208-2-git-send-email-pkusunyifeng@gmail.com
State Accepted
Headers show
Series [ovs-dev,1/2] ovsdb-idl: properly destroy ovsdb_idl.server | expand

Commit Message

Yifeng Sun April 3, 2018, 5:12 p.m. UTC
It is possible that 'fm->match' gets initialized twice in this function,
which makes the first one leak because its pointer is overwritten by the
second initialization.

This patch fixes this issue.

Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>
---
 lib/ofp-flow.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Ben Pfaff April 4, 2018, 9:05 p.m. UTC | #1
On Tue, Apr 03, 2018 at 10:12:59AM -0700, Yifeng Sun wrote:
> It is possible that 'fm->match' gets initialized twice in this function,
> which makes the first one leak because its pointer is overwritten by the
> second initialization.
> 
> This patch fixes this issue.
> 
> Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com>

Thanks, applied to master.  I added:

Fixes: 6a6b7060655e ("ofp-flow: Reduce memory consumption for ofputil_flow_mod, using minimatch.")
diff mbox series

Patch

diff --git a/lib/ofp-flow.c b/lib/ofp-flow.c
index d07556245b1f..3744cdbd8079 100644
--- a/lib/ofp-flow.c
+++ b/lib/ofp-flow.c
@@ -272,7 +272,6 @@  ofputil_decode_flow_mod(struct ofputil_flow_mod *fm,
                  * existing cookie. */
                 return OFPERR_NXBRC_NXM_INVALID;
             }
-            minimatch_init(&fm->match, &match);
             fm->priority = ntohs(nfm->priority);
             fm->new_cookie = nfm->cookie;
             fm->idle_timeout = ntohs(nfm->idle_timeout);