From 766972a3cd8262fb06438c2363a0068472b9b627 Mon Sep 17 00:00:00 2001 From: "Eliel C. Sardanons" Date: Sat, 16 May 2009 18:32:11 +0000 Subject: 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. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194945 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/pbx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'main/pbx.c') diff --git a/main/pbx.c b/main/pbx.c index 2a10e9b00..e01877135 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -5358,6 +5358,7 @@ int ast_register_application2(const char *app, int (*execute)(struct ast_channel } if (ast_string_field_init(tmp, 128)) { + AST_RWLIST_UNLOCK(&apps); ast_free(tmp); return -1; } @@ -6653,11 +6654,7 @@ int ast_unregister_application(const char *app) 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; } -- cgit v1.2.3