[asterisk-commits] eliel: trunk r194945 - /trunk/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 16 13:32:27 CDT 2009


Author: eliel
Date: Sat May 16 13:32:11 2009
New Revision: 194945

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=194945
Log:
Fix a missing unlock in case of error, and a missing free().

Always free the allocated memory for a string field, because
we are always using it (not only when xmldocs are enabled).
Also if there is an error allocating memory for the string field
remember to unlock the list of registered applications, before returning.


Modified:
    trunk/main/pbx.c

Modified: trunk/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/main/pbx.c?view=diff&rev=194945&r1=194944&r2=194945
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Sat May 16 13:32:11 2009
@@ -5358,6 +5358,7 @@
 	}
 
 	if (ast_string_field_init(tmp, 128)) {
+		AST_RWLIST_UNLOCK(&apps);
 		ast_free(tmp);
 		return -1;
 	}
@@ -6653,11 +6654,7 @@
 			unreference_cached_app(tmp);
 			AST_RWLIST_REMOVE_CURRENT(list);
 			ast_verb(2, "Unregistered application '%s'\n", tmp->name);
-#ifdef AST_XML_DOCS
-			if (tmp->docsrc == AST_XML_DOC) {
-				ast_string_field_free_memory(tmp);
-			}
-#endif
+			ast_string_field_free_memory(tmp);
 			ast_free(tmp);
 			break;
 		}




More information about the asterisk-commits mailing list