[Freeswitch-svn] [commit] r12888 - freeswitch/trunk/src/mod/event_handlers/mod_erlang_event

FreeSWITCH SVN andrew at freeswitch.org
Thu Apr 2 09:11:15 PDT 2009


Author: andrew
Date: Thu Apr  2 11:11:15 2009
New Revision: 12888

Log:
Remember kids, practice safe memory management!


Modified:
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/handle_msg.c
   freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/handle_msg.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/handle_msg.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/handle_msg.c	Thu Apr  2 11:11:15 2009
@@ -207,8 +207,8 @@
 		}
 
 		/*switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf);*/
-		free(nbuf->buff);
-		free(nbuf);
+		switch_safe_free(nbuf->buff);
+		switch_safe_free(nbuf);
 	}
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -794,7 +794,7 @@
 		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;
 }

Modified: freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	Thu Apr  2 11:11:15 2009
@@ -442,9 +442,9 @@
 
 	/* cleanup */
 	switch_core_hash_delete(ptr->listener->fetch_reply_hash, uuid_str);
-	free(rep->buff);
-	free(rep);
-	free(xmlstr);
+	switch_safe_free(rep->buff);
+	switch_safe_free(rep);
+	switch_safe_free(xmlstr);
 
 	return xml;
 }
@@ -624,8 +624,8 @@
 				switch_mutex_unlock(listener->sock_mutex);
 				
 				ei_x_free(&lbuf);
-				free(dnode->data);
-				free(dnode);
+				switch_safe_free(dnode->data);
+				switch_safe_free(dnode);
 			}
 		}
 	}
@@ -1145,7 +1145,7 @@
 
 		session_element->process.type = 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_clear_flag(session_element, LFLAG_OUTBOUND_INIT);
 		switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID);



More information about the Freeswitch-svn mailing list