aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2022-09-15 12:10:32 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2022-09-15 12:16:30 +0200
commite71af5019bcc77730cb60758a913b5b3695bf8d9 (patch)
tree081197a98e5f24a2b6aec5e6242dd52edf3e23f8
parentd8b5bf08e8089ad7d8fc1194e5a247cdb261a476 (diff)
pcu_sock: fix memleak
pcu_sock_read() may not free the message buffer in case the recv returned errno EAGAIN. This is already fixed in osmo-bts, lets fix it in osmo-bsc as well. Related: OS#5198 Change-Id: I49eda447fc1912c1f7f25ba07331cb84decf4548
-rw-r--r--src/osmo-bsc/pcu_sock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/osmo-bsc/pcu_sock.c b/src/osmo-bsc/pcu_sock.c
index 45ff835f1..2cf1ab5d2 100644
--- a/src/osmo-bsc/pcu_sock.c
+++ b/src/osmo-bsc/pcu_sock.c
@@ -567,8 +567,10 @@ static int pcu_sock_read(struct osmo_fd *bfd)
goto close;
if (rc < 0) {
- if (errno == EAGAIN)
+ if (errno == EAGAIN) {
+ msgb_free(msg);
return 0;
+ }
goto close;
}