rem: goto error2;
add: unlock_pdomain(d); return -3;
context: int handle_subscription(struct sip_msg* _m, char* _domain, char* _s2){	struct pdomain* d;	struct presentity *p;	struct watcher* w;	str p_uri;	char tmp[64];	int i;	LOG(L_ERR, "handle_subscription() entered\n");	get_act_time();	paerrno = PA_OK;	if (parse_hfs(_m, 0) < 0) {		LOG(L_ERR, "handle_subscription(): Error while parsing message header\n");		goto error;	}	if (check_message(_m) < 0) {		LOG(L_ERR, "handle_subscription(): Error while checking message\n");		goto error;	}	d = (struct pdomain*)_domain;	if (get_pres_uri(_m, &p_uri) < 0) {		LOG(L_ERR, "handle_subscription(): Error while extracting presentity URI\n");		goto error;	}	lock_pdomain(d);		LOG(L_ERR, "handle_subscription(): -1-\n");	if (find_presentity(d, &p_uri, &p) > 0) {		LOG(L_ERR, "handle_subscription(): -2-\n");		if (create_presentity(_m, d, &p_uri, &p, &w) < 0) {			LOG(L_ERR, "handle_subscription(): Error while creating new presentity\n");			goto error2;		}	} else {		LOG(L_ERR, "handle_subscription(): -3-\n");		if (update_presentity(_m, d, p, &w) < 0) {			LOG(L_ERR, "handle_subscription(): Error while updating presentity\n");			goto error2;		}	}	/* add expires header field into response */	if (w) i = w->expires - act_time;	else i = 0;	if (i < 0) i = 0;	sprintf(tmp, "Expires: %d\r\n", i);	if (!add_lump_rpl(_m, tmp, strlen(tmp), LUMP_RPL_HDR)) {		LOG(L_ERR, "handle_subscription(): Can't add Expires header to the response\n");		/* return -1; */	}		if (send_reply(_m) < 0) {	  LOG(L_ERR, "handle_subscription(): Error while sending reply\n");	  goto error2;	}	if (p) {		p->flags |= PFLAG_WATCHERINFO_CHANGED;	}	if (w) {		w->flags |= WFLAG_SUBSCRIPTION_CHANGED;	}	LOG(L_ERR, "handle_subscription about to return 1: w->event_package=%d w->accept=%d p->flags=%x w->flags=%x w=%p\n",	    (w ? w->event_package : -1), (w ? w->preferred_mimetype : -1), (p ? p->flags : -1), (w ? w->flags : -1), w);	unlock_pdomain(d);	return 1;	 error2:	LOG(L_ERR, "handle_subscription about to return -1\n");	unlock_pdomain(d);	return -1; error:	LOG(L_ERR, "handle_subscription about to send_reply and return -2\n");	send_reply(_m);	return -1;}