[sr-dev] git:master:04dc5d6c: auth_diameter: init variable and check before freeing

Daniel-Constantin Mierla miconda at gmail.com
Wed Dec 2 09:54:36 CET 2020


Module: kamailio
Branch: master
Commit: 04dc5d6c66c85d0d411aa23b27bc6be00258eff6
URL: https://github.com/kamailio/kamailio/commit/04dc5d6c66c85d0d411aa23b27bc6be00258eff6

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-12-02T09:45:48+01:00

auth_diameter: init variable and check before freeing

---

Modified: src/modules/auth_diameter/message.c

---

Diff:  https://github.com/kamailio/kamailio/commit/04dc5d6c66c85d0d411aa23b27bc6be00258eff6.diff
Patch: https://github.com/kamailio/kamailio/commit/04dc5d6c66c85d0d411aa23b27bc6be00258eff6.patch

---

diff --git a/src/modules/auth_diameter/message.c b/src/modules/auth_diameter/message.c
index ad81816a42..2dcb80de16 100644
--- a/src/modules/auth_diameter/message.c
+++ b/src/modules/auth_diameter/message.c
@@ -185,7 +185,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
 															int attach_buf)
 {
 	unsigned char *ptr;
-	AAAMessage    *msg;
+	AAAMessage    *msg = NULL;
 	unsigned char version;
 	unsigned int  msg_len;
 	AAA_AVP       *avp;
@@ -310,7 +310,9 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
 	return  msg;
 error:
 	LM_ERR(" message conversion dropped!!\n");
-	AAAFreeMessage(&msg);
+	if (msg) {
+		AAAFreeMessage(&msg);
+	}
 	return 0;
 }
 




More information about the sr-dev mailing list