Skip to content

Commit

Permalink
auth_diameter: init variable and check before freeing
Browse files Browse the repository at this point in the history
(cherry picked from commit 04dc5d6)
  • Loading branch information
miconda committed Dec 11, 2020
1 parent e7f616d commit 7ef04a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/auth_diameter/message.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 7ef04a1

Please sign in to comment.