mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	app_confbridge: Fix memory leak on updated menu options.
If the CONFBRIDGE function is used to dynamically set menu options, a memory leak occurs when a menu option that has been set is overridden, since the menu entry is not destroyed before being freed. This ensures that it is. Additionally, logic that duplicates the destroy function is removed in lieu of the destroy function itself. ASTERISK-28422 #close Change-Id: I71cfb5c24e636984d41086d1333a416dc12ff995
This commit is contained in:
		
				
					committed by
					
						 George Joseph
						George Joseph
					
				
			
			
				
	
			
			
			
						parent
						
							df4ba41731
						
					
				
				
					commit
					ba5febd14c
				
			| @@ -1440,10 +1440,7 @@ static int add_menu_entry(struct conf_menu *menu, const char *dtmf, const char * | |||||||
|  |  | ||||||
| 	/* if adding any of the actions failed, bail */ | 	/* if adding any of the actions failed, bail */ | ||||||
| 	if (res) { | 	if (res) { | ||||||
| 		struct conf_menu_action *menu_action; | 		conf_menu_entry_destroy(menu_entry); | ||||||
| 		while ((menu_action = AST_LIST_REMOVE_HEAD(&menu_entry->actions, action))) { |  | ||||||
| 			ast_free(menu_action); |  | ||||||
| 		} |  | ||||||
| 		ast_free(menu_entry); | 		ast_free(menu_entry); | ||||||
| 		return -1; | 		return -1; | ||||||
| 	} | 	} | ||||||
| @@ -1452,6 +1449,7 @@ static int add_menu_entry(struct conf_menu *menu, const char *dtmf, const char * | |||||||
| 	AST_LIST_TRAVERSE_SAFE_BEGIN(&menu->entries, cur, entry) { | 	AST_LIST_TRAVERSE_SAFE_BEGIN(&menu->entries, cur, entry) { | ||||||
| 		if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) { | 		if (!strcasecmp(cur->dtmf, menu_entry->dtmf)) { | ||||||
| 			AST_LIST_REMOVE_CURRENT(entry); | 			AST_LIST_REMOVE_CURRENT(entry); | ||||||
|  | 			conf_menu_entry_destroy(cur); | ||||||
| 			ast_free(cur); | 			ast_free(cur); | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user