rem: if (insert_new_lump_after(anchor, buf, ADIRECTION_LEN, 0) == NULL) { LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n");
add: if (insert_new_lump_after(anchor, buf, ADIRECTION_LEN, 0)==NULL) { LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after " "failed\n");
context: fix_nated_sdp_f(struct sip_msg* msg, char* str1, char* str2){	str body, body1, oldip, newip;	int level, pf;	char *buf;	struct lump* anchor;	level = (int)(long)str1;	if (extract_body(msg, &body) == -1) {		LOG(L_ERR,"ERROR: fix_nated_sdp: cannot extract body from msg!\n");		return -1;	}	if (level & (ADD_ADIRECTION | ADD_ANORTPPROXY)) {		msg->msg_flags |= FL_FORCE_ACTIVE;		anchor = anchor_lump(msg, body.s + body.len - msg->buf, 0, 0);		if (anchor == NULL) {			LOG(L_ERR, "ERROR: fix_nated_sdp: anchor_lump failed\n");			return -1;		}		if (level & ADD_ADIRECTION) {			buf = pkg_malloc(ADIRECTION_LEN * sizeof(char));			if (buf == NULL) {				LOG(L_ERR, "ERROR: fix_nated_sdp: out of memory\n");				return -1;			}			memcpy(buf, ADIRECTION, ADIRECTION_LEN);			if (insert_new_lump_after(anchor, buf, ADIRECTION_LEN, 0) == NULL) {				LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n");				pkg_free(buf);				return -1;			}		}		if (level & ADD_ANORTPPROXY) {			buf = pkg_malloc(ANORTPPROXY_LEN * sizeof(char));			if (buf == NULL) {				LOG(L_ERR, "ERROR: fix_nated_sdp: out of memory\n");				return -1;			}			memcpy(buf, ANORTPPROXY, ANORTPPROXY_LEN);			if (insert_new_lump_after(anchor, buf, ANORTPPROXY_LEN, 0) == NULL) {				LOG(L_ERR, "ERROR: fix_nated_sdp: insert_new_lump_after failed\n");				pkg_free(buf);				return -1;			}		}	}	if (level & FIX_MEDIP) { 		/* Iterate all c= and replace ips in them. */ 		unsigned hasreplaced = 0; 		int pf1 = 0; 		str body2; 		char *bodylimit = body.s + body.len; 		newip.s = ip_addr2a(&msg->rcv.src_ip); 		newip.len = strlen(newip.s); 		body1 = body; 		for(;;) { 			if (extract_mediaip(&body1, &oldip, &pf) == -1) 				break; 			if (pf != AF_INET) { 				LOG(L_ERR, "ERROR: fix_nated_sdp: " 				    "not an IPv4 address in SDP\n"); 				goto finalize; 			} 			if (!pf1) 				pf1 = pf; 			else if (pf != pf1) { 				LOG(L_ERR, "ERROR: fix_nated_sdp: mismatching " 				    "address families in SDP\n"); 				return -1; 			} 			body2.s = oldip.s + oldip.len; 			body2.len = bodylimit - body2.s; 			if (alter_mediaip(msg, &body1, &oldip, pf, &newip, pf, 			    1) == -1) 			{ 				LOG(L_ERR, "ERROR: fix_nated_sdp: can't alter media IP\n"); 				return -1; 			} 			hasreplaced = 1; 			body1 = body2; 		} 		if (!hasreplaced) { 			LOG(L_ERR, "ERROR: fix_nated_sdp: can't extract media IP from the SDP\n"); 			goto finalize; 		}	}finalize:	return 1;}