Summary: | ASTERISK-06063: [patch] missing ast_unloc() in pbx.c::__ast_context_destroy() | ||
Reporter: | Luigi Rizzo (rizzo) | Labels: | |
Date Opened: | 2006-01-12 05:30:43.000-0600 | Date Closed: | 2008-01-15 16:14:48.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | the following block near line 5140 in pbx.c::__ast_context_destroy() returns without releasing conlock. Given the structure of the code, the easiest fix is to replace the 'return' with a 'break'. /* Okay, let's lock the structure to be sure nobody else is searching through it. */ if (ast_mutex_lock(&tmp->lock)) { ast_log(LOG_WARNING, "Unable to lock context lock\n"); - return; + break; } ****** ADDITIONAL INFORMATION ****** The function could be further simplified and optimized - e.g. the 'ast_mutex_unlock/return' pair near the end of the function can be replaced by a single 'break'; and, there is no need to restart from the beginning after a match with con == NULL, simply set tmp = (tmpl ? tmpl->next : contexts); and continue. A more complete patch will come later, probably... | ||
Comments: | By: Mark Spencer (markster) 2006-01-12 10:34:32.000-0600 Fixed in SVN trunk ASTERISK-7805, probably doesn't need to be in head since the lock can't fail to lock. By: Digium Subversion (svnbot) 2008-01-15 16:14:48.000-0600 Repository: asterisk Revision: 8017 U trunk/pbx.c ------------------------------------------------------------------------ r8017 | markster | 2008-01-15 16:14:48 -0600 (Tue, 15 Jan 2008) | 2 lines Remove unnecessary (but unexecutable) unlocks, cleanup code (bug ASTERISK-6063) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=8017 |