[asterisk-commits] wedhorn: branch wedhorn/skinny-session r384130 - /team/wedhorn/skinny-session...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 27 14:19:15 CDT 2013
Author: wedhorn
Date: Wed Mar 27 14:19:11 2013
New Revision: 384130
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384130
Log:
skinny: move skinny_unregister and free(req) calls to end of skinny_session
Modified:
team/wedhorn/skinny-session/channels/chan_skinny.c
Modified: team/wedhorn/skinny-session/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/wedhorn/skinny-session/channels/chan_skinny.c?view=diff&rev=384130&r1=384129&r2=384130
==============================================================================
--- team/wedhorn/skinny-session/channels/chan_skinny.c (original)
+++ team/wedhorn/skinny-session/channels/chan_skinny.c Wed Mar 27 14:19:11 2013
@@ -7266,7 +7266,6 @@
if ((!s->device) && (letohl(req->e) != REGISTER_MESSAGE && letohl(req->e) != ALARM_MESSAGE)) {
ast_log(LOG_WARNING, "Client sent message #%d without first registering.\n", req->e);
- ast_free(req);
return 0;
}
@@ -7285,7 +7284,6 @@
transmit_capabilitiesreq(s->device);
} else {
transmit_registerrej(s);
- ast_free(req);
return -1;
}
case IP_PORT_MESSAGE:
@@ -7391,8 +7389,6 @@
SKINNY_DEBUG(DEBUG_PACKET, 3, "Received UNKNOWN_MESSAGE(%x) from %s\n", letohl(req->e), d->name);
break;
}
- if (res >= 0 && req)
- ast_free(req);
return res;
}
@@ -7427,7 +7423,7 @@
static void *skinny_session(void *data)
{
int res;
- struct skinny_req *req;
+ struct skinny_req *req = NULL;
struct skinnysession *s = data;
int dlen = 0;
@@ -7480,7 +7476,6 @@
} else {
ast_log(LOG_WARNING, "Skinny Client failed to authenticate in %d seconds\n", auth_timeout);
}
- skinny_unregister(NULL, s);
ast_verb(3, "Ending Skinny session from %s (bad input)\n", ast_inet_ntoa(s->sin.sin_addr));
break;
}
@@ -7494,7 +7489,6 @@
ast_log(LOG_WARNING, "Skinny Client was lost, unregistering\n");
- skinny_unregister(NULL, s);
ast_mutex_unlock(&s->lock);
ast_verb(3, "Ending Skinny session from %s (bad input)\n", ast_inet_ntoa(s->sin.sin_addr));
break;
@@ -7504,7 +7498,6 @@
if (res == 0) {
ast_log(LOG_WARNING, "Skinny Client was lost, unregistering\n");
- skinny_unregister(NULL, s);
}
ast_verb(3, "Ending Skinny session from %s (bad input)\n", ast_inet_ntoa(s->sin.sin_addr));
break;
@@ -7554,7 +7547,6 @@
if (letohl(req->e) < 0) {
ast_log(LOG_ERROR, "Event Message is NULL from socket %d, This is bad\n", s->fd);
- ast_free(req);
ast_verb(3, "Ending Skinny session from %s (failed parse)\n", ast_inet_ntoa(s->sin.sin_addr));
break;
}
@@ -7565,9 +7557,17 @@
break;
}
}
+ if (req) {
+ ast_free(req);
+ req = NULL;
+ }
}
ast_debug(3, "Skinny Session returned: %s\n", strerror(errno));
+ if (req) {
+ ast_free(req);
+ }
+ skinny_unregister(NULL, s);
destroy_session(s);
return 0;
More information about the asterisk-commits
mailing list