add: if (calculate_hooks(*_d) < 0) { LOG(L_ERR, "new_dlg_uac(): Error while calculating hooks\n"); shm_free(res); return -2; }
context: int new_dlg_uac(str* _cid, str* _ltag, unsigned int _lseq, str* _luri, str* _ruri, dlg_t** _d){	dlg_t* res;	if (!_cid || !_ltag || !_luri || !_ruri || !_d) {		LOG(L_ERR, "new_dlg_uac(): Invalid parameter value\n");		return -1;	}	res = (dlg_t*)shm_malloc(sizeof(dlg_t));	if (res == 0) {		LOG(L_ERR, "new_dlg_uac(): No memory left\n");		return -2;	}	     /* Clear everything */	memset(res, 0, sizeof(dlg_t));		     /* Make a copy of Call-ID */	if (str_duplicate(&res->id.call_id, _cid) < 0) return -3;	     /* Make a copy of local tag (usually From tag) */	if (str_duplicate(&res->id.loc_tag, _ltag) < 0) return -4;	     /* Make a copy of local URI (usually From) */	if (str_duplicate(&res->loc_uri, _luri) < 0) return -5;	     /* Make a copy of remote URI (usually To) */	if (str_duplicate(&res->rem_uri, _ruri) < 0) return -6;	     /* Make a copy of local sequence (usually CSeq) */	res->loc_seq.value = _lseq;	     /* And mark it as set */	res->loc_seq.is_set = 1;	*_d = res;	return 0;}