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 |
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 --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(); }
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(-)