libosmocore/src
Neels Hofmeyr cd325efae5 gprs_bssgp: bssgp_fc_in(): fix mem leak on queue overflow
All successful and all error code paths of bssgp_fc_in() free the msgb, except
the code path calling fc_enqueue() when the msg is dropped (due to queue being
full, or failure to allocate).

Callers could theoretically catch the -ENOSPC return value and discard the
msgb. However, in other code paths, a callback's return value is returned,
which is expected to free the msgb, so such callback would have to never return
-ENOSPC when it freed the msgb. Much simpler semantics would be to free the
msgb in every code path, no matter which kind of error occurred.

Who is currently calling bssgp_fc_in and how do they handle the return value?
- bssgp_fc_test.c ignores the return value (and hits a mem leak aka sanitizer
  build failure if the queue is full).
- fc_timer_cb() ignores the return value.
- bssgp_tx_dl_ud() returns the bssgp_fc_in() rc.
  - which is returned by a cascade of functions leading up to being returned,
    for example, by gprs_llgmm_reset(), which is usually called with ignored
    return code.
At this point it is already fairly clear that bssgp_fc_in() should always free
the msgb, since the callers don't seem to distinguish even between error or
success, let alone between -ENOSPC or other errors.

bssgp_fc_test: assert that no msgbs remain unfreed after the tests.
Adjust expected results.

Helps fix sanitizer build on debian 9.

Change-Id: I00c62a104baeaad6a85883c380259c469aebf0df
2017-11-20 17:22:42 +01:00
..
codec Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
coding Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
ctrl Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
gb gprs_bssgp: bssgp_fc_in(): fix mem leak on queue overflow 2017-11-20 17:22:42 +01:00
gsm gsm: Use correct include for getrandom 2017-11-16 16:33:57 +01:00
pseudotalloc Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
sim Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
vty Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
Makefile.am conv_acc: Our code requires SSSE3, not just SSE3 2017-11-17 11:44:22 +01:00
application.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
backtrace.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
bitcomp.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
bits.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
bitvec.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
conv.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
conv_acc.c conv_acc: Our code requires SSSE3, not just SSE3 2017-11-17 11:44:22 +01:00
conv_acc_generic.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
conv_acc_sse.c conv_acc: Our code requires SSSE3, not just SSE3 2017-11-17 11:44:22 +01:00
conv_acc_sse_avx.c conv_acc: Our code requires SSSE3, not just SSE3 2017-11-17 11:44:22 +01:00
conv_acc_sse_impl.h Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
counter.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
crc16.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
crcXXgen.c.tpl Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
fsm.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
gsmtap_util.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
logging.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
logging_gsmtap.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
logging_syslog.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
loggingrb.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
macaddr.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
msgb.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
msgfile.c memleak: osmo_config_list_parse: getline() needs free also on error 2017-11-18 10:30:57 +00:00
panic.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
plugin.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
prbs.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
prim.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
rate_ctr.c rate_ctr: fix mem leak for mangled desc 2017-11-20 16:21:44 +00:00
rbtree.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
select.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
sercomm.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
serial.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
signal.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
socket.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
stat_item.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
stats.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
stats_statsd.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
strrb.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
timer.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
timer_gettimeofday.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
utils.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00
write_queue.c Fix/Update copyright notices; Add SPDX annotation 2017-11-13 01:35:12 +09:00