@@ -131,14 +131,11 @@ oftrace_push_ct_state(struct ovs_list *next_ct_states, uint32_t ct_state)
static uint32_t
oftrace_pop_ct_state(struct ovs_list *next_ct_states)
{
- struct ovs_list *list_node = ovs_list_pop_front(next_ct_states);
- struct oftrace_next_ct_state *next_ct_state;
-
- ASSIGN_CONTAINER(next_ct_state, list_node, node);
- uint32_t ct_state = next_ct_state->state;
- free(next_ct_state);
-
- return ct_state;
+ struct oftrace_next_ct_state *s;
+ LIST_FOR_EACH_POP (s, node, next_ct_states) {
+ return s->state;
+ }
+ OVS_NOT_REACHED();
}
static void
@@ -404,6 +401,14 @@ exit:
}
static void
+free_ct_states(struct ovs_list *ct_states)
+{
+ while (!ovs_list_is_empty(ct_states)) {
+ oftrace_pop_ct_state(ct_states);
+ }
+}
+
+static void
ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[],
void *aux OVS_UNUSED)
{
@@ -428,6 +433,7 @@ ofproto_unixctl_trace(struct unixctl_conn *conn, int argc, const char *argv[],
unixctl_command_reply_error(conn, error);
free(error);
}
+ free_ct_states(&next_ct_states);
}
static void
@@ -528,6 +534,7 @@ exit:
ds_destroy(&result);
dp_packet_delete(packet);
ofpbuf_uninit(&ofpacts);
+ free_ct_states(&next_ct_states);
}
static void