diff mbox series

[ovs-dev,v2] ofproto/trace: Fix memory leak in oftrace_push_ct_state()

Message ID 1509580792-4096-1-git-send-email-yihung.wei@gmail.com
State Accepted
Headers show
Series [ovs-dev,v2] ofproto/trace: Fix memory leak in oftrace_push_ct_state() | expand

Commit Message

Yi-Hung Wei Nov. 1, 2017, 11:59 p.m. UTC
Free the allocated memory in the pop function.

Fixes: 0f2f05bbcf743 ("ofproto/trace: Add --ct-next option to ofproto/trace")
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
 ofproto/ofproto-dpif-trace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Nov. 2, 2017, 6:23 p.m. UTC | #1
On Wed, Nov 01, 2017 at 04:59:52PM -0700, Yi-Hung Wei wrote:
> Free the allocated memory in the pop function.
> 
> Fixes: 0f2f05bbcf743 ("ofproto/trace: Add --ct-next option to ofproto/trace")
> Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>

Thank you for the fix!  I applied this to master and branch-2.8.
diff mbox series

Patch

diff --git a/ofproto/ofproto-dpif-trace.c b/ofproto/ofproto-dpif-trace.c
index d8a559ab6394..d5da48e326bb 100644
--- a/ofproto/ofproto-dpif-trace.c
+++ b/ofproto/ofproto-dpif-trace.c
@@ -135,7 +135,9 @@  oftrace_pop_ct_state(struct ovs_list *next_ct_states)
 {
     struct oftrace_next_ct_state *s;
     LIST_FOR_EACH_POP (s, node, next_ct_states) {
-        return s->state;
+        uint32_t state = s->state;
+        free(s);
+        return state;
     }
     OVS_NOT_REACHED();
 }