[svn-commits] mjordan: branch 11 r391507 - in /branches/11: ./ main/format.c main/loader.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 11 21:25:25 CDT 2013


Author: mjordan
Date: Tue Jun 11 21:25:23 2013
New Revision: 391507

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391507
Log:
Fix memory leak while loading priority modules and adding formats

This patch fixes two memory leaks:
 * When we load a module with the LOAD_PRIORITY flag, we remove its entry from
   the load order list. Unfortunately, we don't free the memory associated with
   entry in the list. This patch corrects that and properly frees the memory
   for the module in the list.

 * When adding a custom format (such as SILK or CELT), the routine for adding
   the format was leaking a reference. RAII_VAR cleans this up properly.

........

Merged revisions 391489 from http://svn.asterisk.org/svn/asterisk/branches/1.8

Modified:
    branches/11/   (props changed)
    branches/11/main/format.c
    branches/11/main/loader.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: branches/11/main/format.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/format.c?view=diff&rev=391507&r1=391506&r2=391507
==============================================================================
--- branches/11/main/format.c (original)
+++ branches/11/main/format.c Tue Jun 11 21:25:23 2013
@@ -916,7 +916,7 @@
 
 static int format_list_add_custom(struct ast_format_list *new)
 {
-	struct ast_format_list *entry;
+	RAII_VAR(struct ast_format_list *, entry, NULL, ao2_cleanup);
 	if (!(entry = ao2_alloc(sizeof(*entry), NULL))) {
 		return -1;
 	}

Modified: branches/11/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/main/loader.c?view=diff&rev=391507&r1=391506&r2=391507
==============================================================================
--- branches/11/main/loader.c (original)
+++ branches/11/main/loader.c Tue Jun 11 21:25:23 2013
@@ -1035,6 +1035,8 @@
 			break;
 		case AST_MODULE_LOAD_PRIORITY:
 			AST_LIST_REMOVE_CURRENT(entry);
+			ast_free(order->resource);
+			ast_free(order);
 			break;
 		}
 	}




More information about the svn-commits mailing list