summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-08-13 17:51:35 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-08-13 18:32:27 +0200
commit39fdaf62ba724c1e343ab281911ba844b6b88989 (patch)
treee1484750a4d547b012eab5aae9303f5baaccf7a8
parent9c3baa89fb6b3fc1ef588930f361d013f98a1e39 (diff)
xua_rkm: Fix xua_msg memleank in handle_rkey_reg_resp
From LeakSanitizer report: Indirect leak of 384 byte(s) in 3 object(s) allocated from: #0 0x7f986da27d99 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:86 #1 0x7f9868d0cb61 in _talloc_zero (/usr/lib/libtalloc.so.2+0x5b61) #2 0x7f986ad33766 in xua_msg_add_data /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_msg.c:73 #3 0x7f986ad343c3 in xua_from_msg_common /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_msg.c:143 #4 0x7f986ad347d2 in xua_from_nested /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_msg.c:201 #5 0x7f986ad65563 in m3ua_rx_rkm_reg_rsp /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_rkm.c:431 #6 0x7f986ad65f96 in m3ua_rx_rkm /home/pespin/dev/sysmocom/git/libosmo-sccp/src/xua_rkm.c:510 #7 0x7f986ad31ef7 in m3ua_rx_msg /home/pespin/dev/sysmocom/git/libosmo-sccp/src/m3ua.c:749 #8 0x7f986ad7c1e8 in xua_cli_read_cb /home/pespin/dev/sysmocom/git/libosmo-sccp/src/osmo_ss7.c:1590 #9 0x7f986a66cdb4 in osmo_stream_cli_read /home/pespin/dev/sysmocom/git/libosmo-netif/src/stream.c:192 #10 0x7f986a66e091 in osmo_stream_cli_fd_cb /home/pespin/dev/sysmocom/git/libosmo-netif/src/stream.c:276 #11 0x7f986994e795 in osmo_fd_disp_fds /home/pespin/dev/sysmocom/git/libosmocore/src/select.c:217 #12 0x7f986994eabb in osmo_select_main /home/pespin/dev/sysmocom/git/libosmocore/src/select.c:257 #13 0x5630cb294bd3 in main /home/pespin/dev/sysmocom/git/osmo-msc/src/osmo-msc/msc_main.c:697 #14 0x7f98678b806a in __libc_start_main (/usr/lib/libc.so.6+0x2306a) #15 0x5630cb292649 in _start (/home/pespin/dev/sysmocom/build/new/out/bin/osmo-msc+0x185649) Following code paths: m3ua_rx_rkm_reg_rsp xua_from_nested xua_from_msg_common xua_msg_add_data talloc_zero (part) handle_rkey_reg_resp Take the chance to fix the same issue in m3ua_rx_rkm_dereg_rsp. Change-Id: I0b15d81099a9f8274b7e39962caa339da644e0dc
-rw-r--r--src/xua_rkm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/xua_rkm.c b/src/xua_rkm.c
index b79f7f3..a77460d 100644
--- a/src/xua_rkm.c
+++ b/src/xua_rkm.c
@@ -433,6 +433,7 @@ static int m3ua_rx_rkm_reg_rsp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
continue;
handle_rkey_reg_resp(asp, inner);
+ xua_msg_free(inner);
}
return 0;
}
@@ -485,6 +486,7 @@ static int m3ua_rx_rkm_dereg_rsp(struct osmo_ss7_asp *asp, struct xua_msg *xua)
continue;
handle_rkey_dereg_resp(asp, inner);
+ xua_msg_free(inner);
}
return 0;
}