--- chan_sip.c 2005-03-03 04:55:04.000000000 -0500 +++ chan_sip.c_fix 2005-03-12 12:40:22.000000000 -0500 @@ -4890,7 +4890,6 @@ ast_log(LOG_NOTICE, "Peer '%s' is trying to register, but not configured as host=dynamic\n", peer->name); } else { p->nat = peer->nat; - transmit_response(p, "100 Trying", req); if (!(res = check_auth(p, req, p->randdata, sizeof(p->randdata), peer->name, peer->secret, peer->md5secret, "REGISTER", uri, 0, ignore))) { sip_cancel_destroy(p); if (parse_contact(p, peer, req)) { @@ -4899,6 +4898,7 @@ update_peer(peer, p->expiry); /* Say OK and ask subsystem to retransmit msg counter */ transmit_response_with_date(p, "200 OK", req); + sip_destroy(p); peer->lastmsgssent = -1; res = 0; } @@ -4921,6 +4921,7 @@ /* Say OK and ask subsystem to retransmit msg counter */ manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: SIP/%s\r\nPeerStatus: Registered\r\n", peer->name); transmit_response_with_date(p, "200 OK", req); + sip_destroy(p); peer->lastmsgssent = -1; res = 0; } @@ -4929,8 +4930,11 @@ if (!res) { ast_device_state_changed("SIP/%s", peer->name); } - if (res < 0) + if (res < 0) { + /* this is a complete rubbish too*/ transmit_response(p, "403 Forbidden", &p->initreq); + sip_destroy(p); + } if (peer && peer->temponly) { if (peer->ha) { ast_free_ha(peer->ha);