[MERGED] osmo-hlr[master]: luop: fix mem leak upon error in lu_op_alloc_conn()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Oct 23 12:20:51 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: luop: fix mem leak upon error in lu_op_alloc_conn()
......................................................................


luop: fix mem leak upon error in lu_op_alloc_conn()

Free allocated luop if osmo_gsup_conn_ccm_get() fails.

Change-Id: I3ebd5fb5e313be452de893248dd58b2bb73ba94a
---
M src/luop.c
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/luop.c b/src/luop.c
index 3bedbaa..ef416ac 100644
--- a/src/luop.c
+++ b/src/luop.c
@@ -127,8 +127,10 @@
 	uint8_t *peer_addr;
 	struct lu_operation *luop = lu_op_alloc(conn->server);
 	int rc = osmo_gsup_conn_ccm_get(conn, &peer_addr, IPAC_IDTAG_SERNR);
-	if (rc < 0)
+	if (rc < 0) {
+		lu_op_free(luop);
 		return NULL;
+	}
 
 	luop->peer = talloc_memdup(luop, peer_addr, rc);
 

-- 
To view, visit https://gerrit.osmocom.org/4307
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ebd5fb5e313be452de893248dd58b2bb73ba94a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list