pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-netif/+/36583?usp=email )

Change subject: tests/stream: Fix missing msgb_free()
......................................................................

tests/stream: Fix missing msgb_free()

Rework a bit the function to early free the rx msg when it is no longer
needed.

Change-Id: I7e7579175aa6a7c1c22eb3bc147a67f6f62ad6bc
---
M tests/stream/stream_test.c
1 file changed, 22 insertions(+), 4 deletions(-)

Approvals:
  osmith: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/tests/stream/stream_test.c b/tests/stream/stream_test.c
index e50752b..d73dd1d 100644
--- a/tests/stream/stream_test.c
+++ b/tests/stream/stream_test.c
@@ -572,15 +572,21 @@
        struct ipa_head *ih = (struct ipa_head *)msg->l1h;
        unsigned char *data;
        struct msgb *m;
-       uint8_t *msgt = msg->l2h; /* Octet right after IPA header */
+       uint8_t msgt;
+
        LOGSRV(conn, "[%u-srv] Received IPA message from stream (payload len = 
%" PRIu16 ")\n",
               ++msgnum_srv, msgb_length(msg));
        LOGSRV(conn, "\tmsg buff data (including stripped headers): %s\n",
               osmo_hexdump((unsigned char *)ih, osmo_ntohs(ih->len) + 
sizeof(*ih)));
        LOGSRV(conn, "\tIPA payload: %s\n", osmo_hexdump(ih->data, 
osmo_ntohs(ih->len)));
-       LOGSRV(conn, "\tType: %s\n", IPAC_MSG_TYPES[*msgt]);
+
+       msgt = *msg->l2h; /* Octet right after IPA header */
+       LOGSRV(conn, "\tType: %s\n", IPAC_MSG_TYPES[msgt]);
        LOGSRV(conn, "\t(msg dump: %s)\n", osmo_hexdump(msg->l1h, msg->len + 
sizeof(struct ipa_head)));
-       if (*msgt == IPAC_MSGT_ID_RESP) { /*  */
+
+       msgb_free(msg);
+
+       if (msgt == IPAC_MSGT_ID_RESP) { /*  */
                LOGSRV(conn, "Send IPAC_MSGT_ID_GET to trigger client to send 
next third\n\n");
                m = osmo_ipa_msg_alloc(128);
                if (m == NULL) {
@@ -590,7 +596,7 @@
                put_ipa_msg(data, m, ipac_msg_idreq_payload);
                osmo_ipa_msg_push_headers(m, IPAC_PROTO_IPACCESS, -1);
                osmo_stream_srv_send(conn, m);
-       } else if (msgnum_srv == 7 && *msgt == IPAC_MSGT_PONG) {
+       } else if (msgnum_srv == 7 && msgt == IPAC_MSGT_PONG) {
                test_segm_ipa_stream_srv_all_msgs_processed = true;
                osmo_stream_srv_destroy(conn);
        }

--
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36583?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: I7e7579175aa6a7c1c22eb3bc147a67f6f62ad6bc
Gerrit-Change-Number: 36583
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to