try to not segfault

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7364 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-01-26 01:41:02 +00:00
parent a2d8262289
commit 2a4a8e765c
2 changed files with 14 additions and 12 deletions

View File

@ -780,7 +780,8 @@ void *su_alloc(su_home_t *home, isize_t size)
*/ */
void su_free(su_home_t *home, void *data) void su_free(su_home_t *home, void *data)
{ {
if (home && data) { if (data) {
if (home) {
su_alloc_t *allocation; su_alloc_t *allocation;
su_block_t *sub = MEMLOCK(home); su_block_t *sub = MEMLOCK(home);
@ -825,6 +826,7 @@ void su_free(su_home_t *home, void *data)
} }
free(data); free(data);
}
} }
/** Check home consistency. /** Check home consistency.

View File

@ -1046,19 +1046,19 @@ void su_msg_save(su_msg_r save, su_msg_r rmsg)
*/ */
void su_msg_destroy(su_msg_r rmsg) void su_msg_destroy(su_msg_r rmsg)
{ {
su_msg_t *msg = rmsg[0];
assert(rmsg); assert(rmsg);
if (rmsg[0]) {
SU_TASK_ZAP(rmsg[0]->sum_to, su_msg_destroy);
SU_TASK_ZAP(rmsg[0]->sum_from, su_msg_destroy);
if (rmsg[0]->sum_deinit)
rmsg[0]->sum_deinit(rmsg[0]->sum_data);
su_free(NULL, rmsg[0]);
}
rmsg[0] = NULL; rmsg[0] = NULL;
if (msg) {
SU_TASK_ZAP(msg->sum_to, su_msg_destroy);
SU_TASK_ZAP(msg->sum_from, su_msg_destroy);
if (msg->sum_deinit)
msg->sum_deinit(msg->sum_data);
su_free(NULL, msg);
}
} }
/** Gets a pointer to the message data area. /** Gets a pointer to the message data area.