diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-02-11 03:54:28 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-02-11 03:54:28 +0000 |
commit | 043834c47de63928d20517615afaa1c19af97d89 (patch) | |
tree | fea0781c0984e9c492dba5885d45940632011a70 | |
parent | 4ab36f26ab0a683cfb903721bcfe1981e8ec3a75 (diff) |
Fix several memory leaks
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@2153 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-x | apps/app_voicemail.c | 1 | ||||
-rwxr-xr-x | channels/chan_iax2.c | 16 | ||||
-rwxr-xr-x | indications.c | 3 | ||||
-rwxr-xr-x | pbx.c | 8 |
4 files changed, 27 insertions, 1 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 536a2e0a8..89c52d91f 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3167,6 +3167,7 @@ static int load_config(void) while(cur) { l = cur; cur = cur->next; + l->alloced = 1; free_user(l); } zcur = zones; diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 9668c193f..1b341b9e6 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5210,6 +5210,7 @@ static struct iax2_peer *build_peer(char *name, struct ast_variable *v) { struct iax2_peer *peer; struct iax2_peer *prev; + struct ast_ha *oldha = NULL; int maskfound=0; int format; int found=0; @@ -5225,6 +5226,8 @@ static struct iax2_peer *build_peer(char *name, struct ast_variable *v) } if (peer) { found++; + oldha = peer->ha; + peer->ha = NULL; /* Already in the list, remove it and it will be added back (or FREE'd) */ if (prev) { prev->next = peer->next; @@ -5351,6 +5354,8 @@ static struct iax2_peer *build_peer(char *name, struct ast_variable *v) if (!found && peer->dynamic) reg_source_db(peer); } + if (oldha) + ast_free_ha(oldha); return peer; } @@ -5358,6 +5363,8 @@ static struct iax2_user *build_user(char *name, struct ast_variable *v) { struct iax2_user *prev, *user; struct iax2_context *con, *conl = NULL; + struct ast_ha *oldha = NULL; + struct iax2_context *oldcon = NULL; int format; int found; @@ -5373,6 +5380,10 @@ static struct iax2_user *build_user(char *name, struct ast_variable *v) } if (user) { found++; + oldha = user->ha; + oldcon = user->contexts; + user->ha = NULL; + user->contexts = NULL; /* Already in the list, remove it and it will be added back (or FREE'd) */ if (prev) { prev->next = user->next; @@ -5458,6 +5469,10 @@ static struct iax2_user *build_user(char *name, struct ast_variable *v) } user->delme = 0; } + if (oldha) + ast_free_ha(oldha); + if (oldcon) + free_context(oldcon); return user; } @@ -5520,6 +5535,7 @@ static void prune_peers(void){ for (peer=peerl.peers;peer;) { peernext = peer->next; if (peer->delme) { + ast_free_ha(peer->ha); for (x=0;x<IAX_MAX_CALLS;x++) { ast_mutex_lock(&iaxsl[x]); if (iaxs[x] && (iaxs[x]->peerpoke == peer)) { diff --git a/indications.c b/indications.c index 55e11ff8b..68b8628d3 100755 --- a/indications.c +++ b/indications.c @@ -318,6 +318,7 @@ static inline void free_zone(struct tone_zone* zone) struct tone_zone_sound *tmp = zone->tones->next; free((void*)zone->tones->name); free((void*)zone->tones->data); + free((void*)zone->ringcadance); free(zone->tones); zone->tones = tmp; } @@ -395,6 +396,8 @@ int ast_unregister_indication_country(const char *country) if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Unregistered indication country '%s'\n",tz->country); free_zone(tz); + if (tone_zones == tz) + tone_zones = tmp; tz = tmp; res = 0; } @@ -4066,6 +4066,7 @@ void __ast_context_destroy(struct ast_context *con, char *registrar, int lock) struct ast_include *tmpi, *tmpil= NULL; struct ast_sw *sw, *swl= NULL; struct ast_exten *e, *el, *en; + struct ast_ignorepat *ipi, *ipl = NULL; if (lock) ast_mutex_lock(&conlock); tmp = contexts; @@ -4090,7 +4091,12 @@ void __ast_context_destroy(struct ast_context *con, char *registrar, int lock) tmpil = tmpi; tmpi = tmpi->next; free(tmpil); - tmpil = tmpi; + } + for (ipi = tmp->ignorepats; ipi; ) { + /* Free includes */ + ipl = ipi; + ipi = ipi->next; + free(ipl); } for (sw = tmp->alts; sw; ) { swl = sw; |