[asterisk-commits] wedhorn: branch 11 r379582 - /branches/11/channels/chan_skinny.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 19 20:53:33 CST 2013


Author: wedhorn
Date: Sat Jan 19 20:53:29 2013
New Revision: 379582

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=379582
Log:
Fix issues with skinny sessions

Fixes a couple of issues with the way skinny handles sessions by ensuring
sessions aren't used after being freed. Some other minor changes.

Review: https://reviewboard.asterisk.org/r/2272/

Modified:
    branches/11/channels/chan_skinny.c

Modified: branches/11/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_skinny.c?view=diff&rev=379582&r1=379581&r2=379582
==============================================================================
--- branches/11/channels/chan_skinny.c (original)
+++ branches/11/channels/chan_skinny.c Sat Jan 19 20:53:29 2013
@@ -6820,15 +6820,21 @@
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&sessions, cur, list) {
 		if (cur == s) {
 			AST_LIST_REMOVE_CURRENT(list);
-			if (s->fd > -1) 
+			if (s->fd > -1) {
 				close(s->fd);
-			
-			if (!s->device)
+			}
+
+			if (s->device) {
+				s->device->session = NULL;
+			} else {
 				ast_atomic_fetchadd_int(&unauth_sessions, -1);
+			}
 
 			ast_mutex_destroy(&s->lock);
-			
+
 			ast_free(s);
+
+			break;
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END
@@ -6966,21 +6972,22 @@
 		res = get_input(s);
 		if (res < 0) {
 			ast_verb(3, "Ending Skinny session from %s (bad input)\n", ast_inet_ntoa(s->sin.sin_addr));
-			break;
+			destroy_session(s);
+			return NULL;
 		}
 
 		if (res > 0)
 		{
 			if (!(req = skinny_req_parse(s))) {
+				ast_verb(3, "Ending Skinny session from %s (failed parse)\n", ast_inet_ntoa(s->sin.sin_addr));
 				destroy_session(s);
-				ast_verb(3, "Ending Skinny session from %s (failed parse)\n", ast_inet_ntoa(s->sin.sin_addr));
 				return NULL;
 			}
 
 			res = handle_message(req, s);
 			if (res < 0) {
+				ast_verb(3, "Ending Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr));
 				destroy_session(s);
-				ast_verb(3, "Ending Skinny session from %s\n", ast_inet_ntoa(s->sin.sin_addr));
 				return NULL;
 			}
 		}




More information about the asterisk-commits mailing list