Index: sys/netinet/cc/cc_newreno.c =================================================================== --- sys/netinet/cc/cc_newreno.c +++ sys/netinet/cc/cc_newreno.c @@ -82,6 +82,7 @@ #define CAST_PTR_INT(X) (*((int*)(X))) static int newreno_cb_init(struct cc_var *ccv); +static void newreno_cb_destroy(struct cc_var *ccv); static void newreno_ack_received(struct cc_var *ccv, uint16_t type); static void newreno_after_idle(struct cc_var *ccv); static void newreno_cong_signal(struct cc_var *ccv, uint32_t type); @@ -96,6 +97,7 @@ struct cc_algo newreno_cc_algo = { .name = "newreno", .cb_init = newreno_cb_init, + .cb_destroy = newreno_cb_destroy, .ack_received = newreno_ack_received, .after_idle = newreno_after_idle, .cong_signal = newreno_cong_signal, @@ -117,11 +119,21 @@ if (nreno != NULL) { nreno->beta = V_newreno_beta; nreno->beta_ecn = V_newreno_beta_ecn; + + ccv->cc_data = nreno; } return (0); } +void +newreno_cb_destroy(struct cc_var *ccv) +{ + if (ccv->cc_data != NULL) + free(ccv->cc_data, M_NEWRENO); +} + + static void newreno_ack_received(struct cc_var *ccv, uint16_t type) {