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

mgcp_test: fix nullpointer dereferentiation

Change-Id: Ic2ee79eaaca2fada673baf6ff4c226aa16c26269
Fixes: Coverity CID#180536
---
M tests/mgcp/mgcp_test.c
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/73/5173/1

diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 86edf00..1c57347 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -788,7 +788,7 @@
                msg = mgcp_handle_message(cfg, inp);
 
                msgb_free(inp);
-               if (check_response(msg->data, t->exp_resp) != 0) {
+               if (msg && check_response(msg->data, t->exp_resp) != 0) {
                        printf("%s failed '%s'\n", t->name, (char *)msg->data);
                        OSMO_ASSERT(false);
                }
@@ -799,7 +799,8 @@
                        OSMO_ASSERT(rc == 0);
                }
 
-               msgb_free(msg);
+               if (msg)
+                       msgb_free(msg);
 
                /* Retransmit... */
                printf("Re-transmitting %s\n", t->name);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2ee79eaaca2fada673baf6ff4c226aa16c26269
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <[email protected]>

Reply via email to