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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Oct 17 01:09:35 UTC 2017


Review at  https://gerrit.osmocom.org/4307

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/07/4307/1

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: newchange
Gerrit-Change-Id: I3ebd5fb5e313be452de893248dd58b2bb73ba94a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list