rem: suffix_len = (_lr ? RR_LR_TERM_LEN : RR_SR_TERM_LEN) + (tag->len ? (RR_FROMTAG_LEN + tag->len) : 0);
add: suffix_len = (_lr ? RR_LR_TERM_LEN : RR_SR_TERM_LEN) + ((tag && tag->len) ? (RR_FROMTAG_LEN + tag->len) : 0);
context: static inline int build_rr(struct lump* _l, struct lump* _l2, int _lr, str* user, str* tag, int _inbound){	char* prefix, *suffix, *crlf, *r2;	int suffix_len, prefix_len;	prefix_len = RR_PREFIX_LEN + (user->len ? (user->len + 1) : 0);	prefix = pkg_malloc(prefix_len);	if (enable_full_lr) {		suffix_len = (_lr ? RR_LR_FULL_TERM_LEN : RR_SR_TERM_LEN) + (tag->len ? (RR_FROMTAG_LEN + tag->len) : 0);	} else {		suffix_len = (_lr ? RR_LR_TERM_LEN : RR_SR_TERM_LEN) + (tag->len ? (RR_FROMTAG_LEN + tag->len) : 0);	}	suffix = pkg_malloc(suffix_len);		crlf = pkg_malloc(2);	r2 = pkg_malloc(RR_R2_LEN);	if (!prefix || !suffix || !crlf || !r2) {		LOG(L_ERR, "build_rr(): No memory left\n");		if (suffix) pkg_free(suffix);		if (prefix) pkg_free(prefix);		if (crlf) pkg_free(crlf);		if (r2) pkg_free(r2);		return -3;	}		memcpy(prefix, RR_PREFIX, RR_PREFIX_LEN);	if (user->len) {		memcpy(prefix + RR_PREFIX_LEN, user->s, user->len);#ifdef ENABLE_USER_CHECK		/* don't add the ignored user into a RR */		if(i_user.len && i_user.len == user->len && 				!strncmp(i_user.s, user->s, i_user.len))		{			if(prefix[RR_PREFIX_LEN]=='x')				prefix[RR_PREFIX_LEN]='y';			else				prefix[RR_PREFIX_LEN]='x';		}#endif		prefix[RR_PREFIX_LEN + user->len] = '@';	}		if (tag->len) {		memcpy(suffix, RR_FROMTAG, RR_FROMTAG_LEN);		memcpy(suffix + RR_FROMTAG_LEN, tag->s, tag->len);		if (enable_full_lr) {			memcpy(suffix + RR_FROMTAG_LEN + tag->len, _lr ? RR_LR_FULL_TERM : RR_SR_TERM, _lr ? RR_LR_FULL_TERM_LEN : RR_SR_TERM_LEN);		} else {			memcpy(suffix + RR_FROMTAG_LEN + tag->len, _lr ? RR_LR_TERM : RR_SR_TERM, _lr ? RR_LR_TERM_LEN : RR_SR_TERM_LEN);		}	} else {		if (enable_full_lr) {			memcpy(suffix, _lr ? RR_LR_FULL_TERM : RR_SR_TERM, _lr ? RR_LR_FULL_TERM_LEN : RR_SR_TERM_LEN);		} else {			memcpy(suffix, _lr ? RR_LR_TERM : RR_SR_TERM, _lr ? RR_LR_TERM_LEN : RR_SR_TERM_LEN);		}	}		memcpy(crlf, CRLF, 2);	memcpy(r2, RR_R2, RR_R2_LEN);	if (!(_l = insert_new_lump_after(_l, prefix, prefix_len, 0))) goto lump_err;	prefix = 0;	if (!(_l = insert_subst_lump_after(_l, _inbound ? SUBST_RCV_ALL : SUBST_SND_ALL, 0))) goto lump_err;	if (enable_double_rr) {		if (!(_l = insert_cond_lump_after(_l, COND_IF_DIFF_REALMS, 0))) goto lump_err;		if (!(_l = insert_new_lump_after(_l, r2, RR_R2_LEN, 0))) goto lump_err;		r2 = 0;	} else {		pkg_free(r2);		r2 = 0;	}	if (!(_l2 = insert_new_lump_before(_l2, suffix, suffix_len, 0))) goto lump_err;	suffix = 0;	if (!(_l2 = insert_new_lump_before(_l2, crlf, 2, 0))) goto lump_err;	crlf = 0;	return 0;	 lump_err:	LOG(L_ERR, "build_rr(): Error while inserting lumps\n");	if (prefix) pkg_free(prefix);	if (suffix) pkg_free(suffix);	if (r2) pkg_free(r2);	if (crlf) pkg_free(crlf);	return -4;}