Browse Source

ims_ipsec_pcscf: fill_contact() don't leak on error

Victor Seva 1 month ago
parent
commit
c6cee2a0c2
1 changed files with 4 additions and 5 deletions
  1. 4 5
      src/modules/ims_ipsec_pcscf/cmd.c

+ 4 - 5
src/modules/ims_ipsec_pcscf/cmd.c

@@ -344,10 +344,9 @@ static int fill_contact(
 		}
 		}
 		free_sip_msg(&tmsg);
 		free_sip_msg(&tmsg);
 
 
-		vb = cscf_get_ue_via(m);
-		if(!vb) {
+		if((vb = cscf_get_ue_via(m)) == NULL) {
 			LM_ERR("Reply No via body headers\n");
 			LM_ERR("Reply No via body headers\n");
-			return -1;
+			goto error;
 		}
 		}
 
 
 		// populate CI with bare minimum
 		// populate CI with bare minimum
@@ -357,8 +356,8 @@ static int fill_contact(
 		ci->searchflag = SEARCH_RECEIVED;
 		ci->searchflag = SEARCH_RECEIVED;
 
 
 		if((srcip = pkg_malloc(50)) == NULL) {
 		if((srcip = pkg_malloc(50)) == NULL) {
-			LM_ERR("Error allocating memory for source IP address\n");
-			return -1;
+			PKG_MEM_ERROR;
+			goto error;
 		}
 		}
 
 
 		ci->received_host.len =
 		ci->received_host.len =