Summary:ASTERISK-14111: [patch] Asterisk crash when logging out from a manager session.
Reporter:Eliel Sardanons (eliel)Labels:
Date Opened:2009-05-12 10:27:29Date Closed:2009-05-12 17:49:22
Versions:Frequency of
Environment:Attachments:( 0) btfull
( 1) manager.diff2
Description:How to reproduce:

1) Login to the asterisk manager.
2) Logout from the asterisk manager.
3) Asterisk crashed.
Comments:By: Matthew Nicholson (mnicholson) 2009-05-12 11:17:50

This crash appears to be caused because session_destructor() is called (by ao2) and then destroy_session()/free_session() is called on the same bit of memory.  

It also looks like session_destructor() does not free the datastore data associated with the session object.

By: Digium Subversion (svnbot) 2009-05-12 17:49:21

Repository: asterisk
Revision: 194060

U   trunk/main/manager.c

r194060 | eliel | 2009-05-12 17:49:18 -0500 (Tue, 12 May 2009) | 22 lines

Fix a crash when logging out from the AMI and avoid astobj2 warning messages.

When the user logout the session was being destroyed twice and the file
descriptor was being closed twice. The sessions reference counter wasn't
used in a proper way.
The 'mansession' structure was being treated as an astobj2 and we were
calling ao2_lock/ao2_unlock causing astobj2 report a warning message and
not locking the structure.
Also we were using an ugly naming convention 'destroy_session',
'session_destroy', 'free_session', ... all this "duplicated" code was merged.

(closes issue ASTERISK-14017)
Reported by: pj
     manager.diff2 uploaded by eliel (license 64)
     Tested by: dhubbard, eliel, mnicholson

(closes issue ASTERISK-14111)
Reported by: eliel

Review: http://reviewboard.asterisk.org/r/248/