aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-04 22:38:13 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2007-11-04 22:38:13 +0000
commitd01bd3f7ace2fd034e63f6aa884a534450aa4ffd (patch)
tree26e451020d5f848e4df9e7056ef81d24ae8a823d
parentd6199734e23aac123cda4075ad33e575341d46fe (diff)
Rename ast_string_field_free_pool to ast_string_field_free_memory,
and ast_string_field_free_all to ast_string_field_reset_all to avoid misuse (due to too similar names and an error in documentation). Fix two related memory leaks in app_meetme. No need to merge to trunk, different fix already applied there. Not applicable to 1.2 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@88471 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--apps/app_meetme.c4
-rw-r--r--channels/chan_iax2.c8
-rw-r--r--channels/chan_sip.c8
-rw-r--r--include/asterisk/stringfields.h6
-rw-r--r--main/channel.c4
5 files changed, 15 insertions, 15 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index 411e1c349..ef5af4c40 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -4406,7 +4406,7 @@ static void destroy_trunk(struct sla_trunk *trunk)
while ((station_ref = AST_LIST_REMOVE_HEAD(&trunk->stations, entry)))
free(station_ref);
- ast_string_field_free_all(trunk);
+ ast_string_field_free_memory(trunk);
free(trunk);
}
@@ -4432,7 +4432,7 @@ static void destroy_station(struct sla_station *station)
while ((trunk_ref = AST_LIST_REMOVE_HEAD(&station->trunks, entry)))
free(trunk_ref);
- ast_string_field_free_all(station);
+ ast_string_field_free_memory(station);
free(station);
}
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index a77fe72bb..d5d711465 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -2010,7 +2010,7 @@ retry:
iax2_frame_free(frame.data);
jb_destroy(pvt->jb);
/* gotta free up the stringfields */
- ast_string_field_free_pools(pvt);
+ ast_string_field_free_memory(pvt);
free(pvt);
}
}
@@ -8955,7 +8955,7 @@ static void peer_destructor(void *obj)
if (peer->dnsmgr)
ast_dnsmgr_release(peer->dnsmgr);
- ast_string_field_free_pools(peer);
+ ast_string_field_free_memory(peer);
}
/*! \brief Create peer structure based on configuration */
@@ -9198,7 +9198,7 @@ static void user_destructor(void *obj)
ast_variables_destroy(user->vars);
user->vars = NULL;
}
- ast_string_field_free_pools(user);
+ ast_string_field_free_memory(user);
}
/*! \brief Create in-memory user structure from configuration */
@@ -9239,7 +9239,7 @@ static struct iax2_user *build_user(const char *name, struct ast_variable *v, st
if (user) {
if (firstpass) {
- ast_string_field_free_pools(user);
+ ast_string_field_free_memory(user);
memset(user, 0, sizeof(struct iax2_user));
if (ast_string_field_init(user, 32)) {
user = user_unref(user);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index cf4ddeb43..800050ddc 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2999,7 +2999,7 @@ static void sip_registry_destroy(struct sip_registry *reg)
ast_sched_del(sched, reg->expire);
if (reg->timeout > -1)
ast_sched_del(sched, reg->timeout);
- ast_string_field_free_pools(reg);
+ ast_string_field_free_memory(reg);
regobjs--;
free(reg);
@@ -3100,7 +3100,7 @@ static void __sip_destroy(struct sip_pvt *p, int lockowner)
}
ast_mutex_destroy(&p->lock);
- ast_string_field_free_pools(p);
+ ast_string_field_free_memory(p);
free(p);
}
@@ -5892,7 +5892,7 @@ static void temp_pvt_cleanup(void *data)
{
struct sip_pvt *p = data;
- ast_string_field_free_pools(p);
+ ast_string_field_free_memory(p);
free(data);
}
@@ -5942,7 +5942,7 @@ static int transmit_response_using_temp(ast_string_field callid, struct sockaddr
__transmit_response(p, msg, req, XMIT_UNRELIABLE);
/* Free the string fields, but not the pool space */
- ast_string_field_free_all(p);
+ ast_string_field_reset_all(p);
return 0;
}
diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h
index c3d675943..8b32f9ee7 100644
--- a/include/asterisk/stringfields.h
+++ b/include/asterisk/stringfields.h
@@ -74,7 +74,7 @@
and their storage pool must be freed:
\code
- ast_string_field_free_all(sample);
+ ast_string_field_free_memory(sample);
free(sample);
\endcode
*/
@@ -361,7 +361,7 @@ void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
structure; it should only be called immediately before freeing
the structure itself.
*/
-#define ast_string_field_free_pools(x) do { \
+#define ast_string_field_free_memory(x) do { \
struct ast_string_field_pool *this, *prev; \
for (this = (x)->__field_mgr.pool; this; this = prev) { \
prev = this->prev; \
@@ -378,7 +378,7 @@ void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
attached to the structure will be available for use by
stringfields again.
*/
-#define ast_string_field_free_all(x) do { \
+#define ast_string_field_reset_all(x) do { \
int index; \
for (index = 0; index < ast_string_field_count(x); index++) \
ast_string_field_index_free(x, index); \
diff --git a/main/channel.c b/main/channel.c
index 9d9da80b4..d1ea7b438 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -776,7 +776,7 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
if (needqueue) {
if (pipe(tmp->alertpipe)) {
ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe!\n");
- ast_string_field_free_pools(tmp);
+ ast_string_field_free_memory(tmp);
free(tmp);
return NULL;
} else {
@@ -1265,7 +1265,7 @@ void ast_channel_free(struct ast_channel *chan)
/* Destroy the jitterbuffer */
ast_jb_destroy(chan);
- ast_string_field_free_pools(chan);
+ ast_string_field_free_memory(chan);
free(chan);
AST_LIST_UNLOCK(&channels);