mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-22 20:56:39 +00:00 
			
		
		
		
	Merge "pbx: Fix leak of timezone for time based includes."
This commit is contained in:
		
							
								
								
									
										19
									
								
								main/pbx.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								main/pbx.c
									
									
									
									
									
								
							| @@ -4755,6 +4755,13 @@ static struct ast_context *find_context_locked(const char *context) | |||||||
| 	return c; | 	return c; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | /*! \brief Free an ast_include and associated data. */ | ||||||
|  | static void include_free(struct ast_include *include) | ||||||
|  | { | ||||||
|  | 	ast_destroy_timing(&(include->timing)); | ||||||
|  | 	ast_free(include); | ||||||
|  | } | ||||||
|  |  | ||||||
| /*! | /*! | ||||||
|  * \brief Remove included contexts. |  * \brief Remove included contexts. | ||||||
|  * This function locks contexts list by &conlist, search for the right context |  * This function locks contexts list by &conlist, search for the right context | ||||||
| @@ -4802,8 +4809,7 @@ int ast_context_remove_include2(struct ast_context *con, const char *include, co | |||||||
| 			else | 			else | ||||||
| 				con->includes = i->next; | 				con->includes = i->next; | ||||||
| 			/* free include and return */ | 			/* free include and return */ | ||||||
| 			ast_destroy_timing(&(i->timing)); | 			include_free(i); | ||||||
| 			ast_free(i); |  | ||||||
| 			ret = 0; | 			ret = 0; | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| @@ -6613,8 +6619,7 @@ int ast_context_add_include2(struct ast_context *con, const char *value, | |||||||
| 	/* ... go to last include and check if context is already included too... */ | 	/* ... go to last include and check if context is already included too... */ | ||||||
| 	for (i = con->includes; i; i = i->next) { | 	for (i = con->includes; i; i = i->next) { | ||||||
| 		if (!strcasecmp(i->name, new_include->name)) { | 		if (!strcasecmp(i->name, new_include->name)) { | ||||||
| 			ast_destroy_timing(&(new_include->timing)); | 			include_free(new_include); | ||||||
| 			ast_free(new_include); |  | ||||||
| 			ast_unlock_context(con); | 			ast_unlock_context(con); | ||||||
| 			errno = EEXIST; | 			errno = EEXIST; | ||||||
| 			return -1; | 			return -1; | ||||||
| @@ -7838,7 +7843,7 @@ static void __ast_internal_context_destroy( struct ast_context *con) | |||||||
| 	for (tmpi = tmp->includes; tmpi; ) { /* Free includes */ | 	for (tmpi = tmp->includes; tmpi; ) { /* Free includes */ | ||||||
| 		struct ast_include *tmpil = tmpi; | 		struct ast_include *tmpil = tmpi; | ||||||
| 		tmpi = tmpi->next; | 		tmpi = tmpi->next; | ||||||
| 		ast_free(tmpil); | 		include_free(tmpil); | ||||||
| 	} | 	} | ||||||
| 	for (ipi = tmp->ignorepats; ipi; ) { /* Free ignorepats */ | 	for (ipi = tmp->ignorepats; ipi; ) { /* Free ignorepats */ | ||||||
| 		struct ast_ignorepat *ipl = ipi; | 		struct ast_ignorepat *ipl = ipi; | ||||||
| @@ -7932,12 +7937,12 @@ void __ast_context_destroy(struct ast_context *list, struct ast_hashtab *context | |||||||
| 					if (pi) { | 					if (pi) { | ||||||
| 						pi->next = i->next; | 						pi->next = i->next; | ||||||
| 						/* free include */ | 						/* free include */ | ||||||
| 						ast_free(i); | 						include_free(i); | ||||||
| 						continue; /* don't change pi */ | 						continue; /* don't change pi */ | ||||||
| 					} else { | 					} else { | ||||||
| 						tmp->includes = i->next; | 						tmp->includes = i->next; | ||||||
| 						/* free include */ | 						/* free include */ | ||||||
| 						ast_free(i); | 						include_free(i); | ||||||
| 						continue; /* don't change pi */ | 						continue; /* don't change pi */ | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user