summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gb/gprs_bssgp.c6
-rw-r--r--tests/gb/bssgp_fc_test.c3
-rw-r--r--tests/gb/bssgp_fc_tests.ok4
3 files changed, 9 insertions, 4 deletions
diff --git a/src/gb/gprs_bssgp.c b/src/gb/gprs_bssgp.c
index 520868e0..d27a94f7 100644
--- a/src/gb/gprs_bssgp.c
+++ b/src/gb/gprs_bssgp.c
@@ -764,7 +764,11 @@ int bssgp_fc_in(struct bssgp_flow_control *fc, struct msgb *msg,
}
if (bssgp_fc_needs_queueing(fc, llc_pdu_len)) {
- return fc_enqueue(fc, msg, llc_pdu_len, priv);
+ int rc;
+ rc = fc_enqueue(fc, msg, llc_pdu_len, priv);
+ if (rc)
+ msgb_free(msg);
+ return rc;
} else {
/* record the time we transmitted this PDU */
osmo_gettimeofday(&time_now, NULL);
diff --git a/tests/gb/bssgp_fc_test.c b/tests/gb/bssgp_fc_test.c
index 7a75a4d3..98e17cc7 100644
--- a/tests/gb/bssgp_fc_test.c
+++ b/tests/gb/bssgp_fc_test.c
@@ -190,7 +190,8 @@ int main(int argc, char **argv)
printf("msgb ctx: %zu b in %zu blocks (0 b in 1 block == just the context)\n",
talloc_total_size(tall_msgb_ctx),
talloc_total_blocks(tall_msgb_ctx));
- /* KNOWN BUG: expecting 0b in 1 block, but a full queue is still a mem leak */
+ OSMO_ASSERT(talloc_total_size(tall_msgb_ctx) == 0);
+ OSMO_ASSERT(talloc_total_blocks(tall_msgb_ctx) == 1);
talloc_free(tall_msgb_ctx);
printf("===== BSSGP flow-control test END\n\n");
diff --git a/tests/gb/bssgp_fc_tests.ok b/tests/gb/bssgp_fc_tests.ok
index d1468434..30d9776e 100644
--- a/tests/gb/bssgp_fc_tests.ok
+++ b/tests/gb/bssgp_fc_tests.ok
@@ -56,7 +56,7 @@ size-max=100 oct, leak-rate=100 oct/s, queue-len=5 msgs, pdu_len=10 oct, pdu_cnt
30: FC OUT Nr 13
40: FC OUT Nr 14
50: FC OUT Nr 15
-msgb ctx: 685 b in 6 blocks (0 b in 1 block == just the context)
+msgb ctx: 0 b in 1 blocks (0 b in 1 block == just the context)
===== BSSGP flow-control test END
===== BSSGP flow-control test START
@@ -229,6 +229,6 @@ size-max=100 oct, leak-rate=100 oct/s, queue-len=5 msgs, pdu_len=10 oct, pdu_cnt
30: FC OUT Nr 13
40: FC OUT Nr 14
50: FC OUT Nr 15
-msgb ctx: 685 b in 6 blocks (0 b in 1 block == just the context)
+msgb ctx: 0 b in 1 blocks (0 b in 1 block == just the context)
===== BSSGP flow-control test END