neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/32613 )
Change subject: fix leak in ranap_new_transp_layer_addr() ......................................................................
fix leak in ranap_new_transp_layer_addr()
Like BIT_STRING_fromBuf(), free any buffer previously kept in the target BIT_STRING_t.
Context: osmo-hnbgw calls ranap_new_transp_layer_addr() to replace an address in a decoded message, before re-encoding it. So far doing so leaked the previous buffer.
Change-Id: Ic92fa317644c3a1f2be9badf455d34fe0b8ea2a4 --- M src/iu_helpers.c 1 file changed, 18 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/13/32613/1
diff --git a/src/iu_helpers.c b/src/iu_helpers.c index 6e2c203..718c30a 100644 --- a/src/iu_helpers.c +++ b/src/iu_helpers.c @@ -217,6 +217,8 @@ buf = CALLOC(len, sizeof(uint8_t)); memcpy(buf, ip_addr, ip_len); } + if (out->buf) + FREEMEM(out->buf); out->buf = buf; out->size = len; out->bits_unused = 0;