nat: Fix some corruption in the test case
diff --git a/openbsc/include/openbsc/bsc_nat.h b/openbsc/include/openbsc/bsc_nat.h
index ad46aaa..f74cae2 100644
--- a/openbsc/include/openbsc/bsc_nat.h
+++ b/openbsc/include/openbsc/bsc_nat.h
@@ -261,6 +261,7 @@
/* create and init the structures */
struct bsc_config *bsc_config_alloc(struct bsc_nat *nat, const char *token);
struct bsc_config *bsc_config_num(struct bsc_nat *nat, int num);
+void bsc_config_free(struct bsc_config *);
void bsc_config_add_lac(struct bsc_config *cfg, int lac);
void bsc_config_del_lac(struct bsc_config *cfg, int lac);
int bsc_config_handles_lac(struct bsc_config *cfg, int lac);
diff --git a/openbsc/src/nat/bsc_nat_utils.c b/openbsc/src/nat/bsc_nat_utils.c
index 6a3b274..cd294cc 100644
--- a/openbsc/src/nat/bsc_nat_utils.c
+++ b/openbsc/src/nat/bsc_nat_utils.c
@@ -142,6 +142,11 @@
return conf;
}
+void bsc_config_free(struct bsc_config *cfg)
+{
+ rate_ctr_group_free(cfg->stats.ctrg);
+}
+
void bsc_config_add_lac(struct bsc_config *cfg, int _lac)
{
struct bsc_lac_entry *lac;
diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c
index 1d9052d..3e943cf 100644
--- a/openbsc/tests/bsc-nat/bsc_nat_test.c
+++ b/openbsc/tests/bsc-nat/bsc_nat_test.c
@@ -377,6 +377,7 @@
talloc_free(parsed);
+ bsc_config_free(con->cfg);
talloc_free(nat);
msgb_free(msg);
}
@@ -548,6 +549,7 @@
abort();
}
+ bsc_config_free(bsc->cfg);
talloc_free(nat);
}