Remember kids, practice safe memory management!

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12888 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Andrew Thompson 2009-04-02 16:11:15 +00:00
parent 8f10e92f15
commit 3c84c89744
2 changed files with 9 additions and 9 deletions

View File

@ -207,8 +207,8 @@ static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff *
} }
/*switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf);*/ /*switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf);*/
free(nbuf->buff); switch_safe_free(nbuf->buff);
free(nbuf); switch_safe_free(nbuf);
} }
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
@ -794,7 +794,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg *msg, e
ei_x_encode_atom(rbuf, "invalid_ref"); ei_x_encode_atom(rbuf, "invalid_ref");
} }
free(pid); /* don't need it */ switch_safe_free(pid); /* don't need it */
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }

View File

@ -442,9 +442,9 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
/* cleanup */ /* cleanup */
switch_core_hash_delete(ptr->listener->fetch_reply_hash, uuid_str); switch_core_hash_delete(ptr->listener->fetch_reply_hash, uuid_str);
free(rep->buff); switch_safe_free(rep->buff);
free(rep); switch_safe_free(rep);
free(xmlstr); switch_safe_free(xmlstr);
return xml; return xml;
} }
@ -624,8 +624,8 @@ static void check_log_queue(listener_t *listener)
switch_mutex_unlock(listener->sock_mutex); switch_mutex_unlock(listener->sock_mutex);
ei_x_free(&lbuf); ei_x_free(&lbuf);
free(dnode->data); switch_safe_free(dnode->data);
free(dnode); switch_safe_free(dnode);
} }
} }
} }
@ -1145,7 +1145,7 @@ session_elem_t* attach_call_to_spawned_process(listener_t* listener, char *modul
session_element->process.type = ERLANG_PID; session_element->process.type = ERLANG_PID;
memcpy(&session_element->process.pid, pid, sizeof(erlang_pid)); memcpy(&session_element->process.pid, pid, sizeof(erlang_pid));
free(pid); /* malloced in handle_ref_tuple */ switch_safe_free(pid); /* malloced in handle_ref_tuple */
switch_set_flag(session_element, LFLAG_SESSION_ALIVE); switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT); switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT);
switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID); switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID);