laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-cbc/+/28878 )

Change subject: cbsp/sbcap: Fix memleak in error condition (tx without link)
......................................................................

cbsp/sbcap: Fix memleak in error condition (tx without link)

Change-Id: I95f6ab4e642529afc583b0747450b83af1e8f32e
---
M src/cbsp_link.c
M src/sbcap_link.c
2 files changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/cbsp_link.c b/src/cbsp_link.c
index a6462ee..5587f58 100644
--- a/src/cbsp_link.c
+++ b/src/cbsp_link.c
@@ -325,6 +325,7 @@
        if (!link) {
                LOGP(DCBSP, LOGL_NOTICE, "Cannot transmit %s: no connection\n",
                        get_value_string(cbsp_msg_type_names, cbsp->msg_type));
+               talloc_free(cbsp);
                return -ENOLINK;
        }

diff --git a/src/sbcap_link.c b/src/sbcap_link.c
index b2a5aa2..07ada0c 100644
--- a/src/sbcap_link.c
+++ b/src/sbcap_link.c
@@ -392,7 +392,8 @@
        if (!link) {
                LOGP(DSBcAP, LOGL_NOTICE, "Cannot transmit msg %s: no 
connection\n",
                     sbcap_pdu_get_name(pdu));
-               return -ENOLINK;
+               rc = -ENOLINK;
+               goto ret_free;
        }

        LOGPSBCAPC(link, LOGL_INFO, "Tx msg %s\n",

--
To view, visit https://gerrit.osmocom.org/c/osmo-cbc/+/28878
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I95f6ab4e642529afc583b0747450b83af1e8f32e
Gerrit-Change-Number: 28878
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-MessageType: merged

Reply via email to