Browse code

auth_diameter: init variable and check before freeing

(cherry picked from commit 04dc5d6c66c85d0d411aa23b27bc6be00258eff6)

Daniel-Constantin Mierla authored on 02/12/2020 08:45:48 • Henning Westerholt committed on 21/12/2020 15:20:13
Showing 1 changed files
... ...
@@ -185,7 +185,7 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
185 185
 															int attach_buf)
186 186
 {
187 187
 	unsigned char *ptr;
188
-	AAAMessage    *msg;
188
+	AAAMessage    *msg = NULL;
189 189
 	unsigned char version;
190 190
 	unsigned int  msg_len;
191 191
 	AAA_AVP       *avp;
... ...
@@ -310,7 +310,9 @@ AAAMessage* AAATranslateMessage( unsigned char* source, unsigned int sourceLen,
310 310
 	return  msg;
311 311
 error:
312 312
 	LM_ERR(" message conversion dropped!!\n");
313
-	AAAFreeMessage(&msg);
313
+	if (msg) {
314
+		AAAFreeMessage(&msg);
315
+	}
314 316
 	return 0;
315 317
 }
316 318