mirror of
https://github.com/asterisk/asterisk.git
synced 2026-07-15 16:16:43 -07:00
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: https://origsvn.digium.com/svn/asterisk/branches/1.4@88471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+4
-4
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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); \
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user