mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	Fix memory corruption when trying to get "core show locks".
Review https://reviewboard.asterisk.org/r/2580/ tried to fix the mismatch in memory pools but had a math error determining the buffer size and didn't address other similar memory pool mismatches. * Effectively reverted the previous patch to go in the same direction as trunk for the returned memory pool of ast_bt_get_symbols(). * Fixed memory leak in ast_bt_get_symbols() when BETTER_BACKTRACES is defined. * Fixed some formatting in ast_bt_get_symbols(). * Fixed sig_pri.c freeing memory allocated by libpri when MALLOC_DEBUG is enabled. * Fixed __dump_backtrace() freeing memory from ast_bt_get_symbols() when MALLOC_DEBUG is enabled. * Moved __dump_backtrace() because of compile issues with the utils directory. (closes issue ASTERISK-22221) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2778/ ........ Merged revisions 397525 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 397528 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		
							
								
								
									
										32
									
								
								main/astmm.c
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								main/astmm.c
									
									
									
									
									
								
							| @@ -158,6 +158,31 @@ AST_MUTEX_DEFINE_STATIC_NOTRACKING(reglock); | ||||
| 		}                                    \ | ||||
| 	} while (0) | ||||
|  | ||||
| void *ast_std_malloc(size_t size) | ||||
| { | ||||
| 	return malloc(size); | ||||
| } | ||||
|  | ||||
| void *ast_std_calloc(size_t nmemb, size_t size) | ||||
| { | ||||
| 	return calloc(nmemb, size); | ||||
| } | ||||
|  | ||||
| void *ast_std_realloc(void *ptr, size_t size) | ||||
| { | ||||
| 	return realloc(ptr, size); | ||||
| } | ||||
|  | ||||
| void ast_std_free(void *ptr) | ||||
| { | ||||
| 	free(ptr); | ||||
| } | ||||
|  | ||||
| void ast_free_ptr(void *ptr) | ||||
| { | ||||
| 	ast_free(ptr); | ||||
| } | ||||
|  | ||||
| static void print_backtrace(struct ast_bt *bt) | ||||
| { | ||||
| 	int i = 0; | ||||
| @@ -172,11 +197,10 @@ static void print_backtrace(struct ast_bt *bt) | ||||
| 		for (i = 3; i < bt->num_frames - 2; i++) { | ||||
| 			astmm_log("#%d: [%p] %s\n", i - 3, bt->addresses[i], strings[i]); | ||||
| 		} | ||||
| 		free(strings); | ||||
| 		ast_std_free(strings); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|  | ||||
| /*! | ||||
|  * \internal | ||||
|  * | ||||
| @@ -343,9 +367,7 @@ static void region_free(struct ast_freed_regions *freed, struct ast_region *reg) | ||||
|  | ||||
| 	if (old) { | ||||
| 		region_data_check(old); | ||||
| 		if (old->bt) { | ||||
| 			old->bt = ast_bt_destroy(old->bt); | ||||
| 		} | ||||
| 		old->bt = ast_bt_destroy(old->bt); | ||||
| 		free(old); | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user