Browse code

ims_diameter_server: check response is not null before json conversion

(cherry picked from commit 6968f1df9e9d3d66810df910d290f3d9368255fe)
(cherry picked from commit beb59d4bf335c927d1224e02a67e81d2f530ca14)

Riccardo Villa authored on 24/02/2021 08:52:59 • Henning Westerholt committed on 22/10/2021 11:22:03
Showing 1 changed files
... ...
@@ -322,7 +322,7 @@ int diameter_request(struct sip_msg * msg, char* peer, char* appid, char* comman
322 322
 		} else {
323 323
 			resp = cdpb.AAASendRecvMessageToPeer(req, &s_peer);
324 324
 			LM_DBG("Successfully sent diameter\n");
325
-			if (AAAmsg2json(resp, &responsejson) == 1) {
325
+			if (resp && AAAmsg2json(resp, &responsejson) == 1) {
326 326
 				return 1;
327 327
 			} else {
328 328
 				LM_ERR("Failed to convert response to JSON\n");
... ...
@@ -337,7 +337,7 @@ int diameter_request(struct sip_msg * msg, char* peer, char* appid, char* comman
337 337
 		} else {
338 338
 			resp = cdpb.AAASendRecvMessage(req);
339 339
 			LM_DBG("Successfully sent diameter\n");
340
-			if (AAAmsg2json(resp, &responsejson) == 1) {
340
+			if (resp && AAAmsg2json(resp, &responsejson) == 1) {
341 341
 				return 1;
342 342
 			} else {
343 343
 				LM_ERR("Failed to convert response to JSON\n");