Commit 391045e6 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

su_root.c: try not to segfault in su_msg_destroy()

Reduced window for race condition in su_msg_destroy().

Patch by Michael Jerris.

parent 3399be61
......@@ -1046,19 +1046,21 @@ void su_msg_save(su_msg_r save, su_msg_r rmsg)
void su_msg_destroy(su_msg_r rmsg)
su_msg_t *msg;
if (rmsg[0]) {
SU_TASK_ZAP(rmsg[0]->sum_to, su_msg_destroy);
SU_TASK_ZAP(rmsg[0]->sum_from, su_msg_destroy);
msg = rmsg[0], rmsg[0] = NULL;
if (rmsg[0]->sum_deinit)
if (msg) {
SU_TASK_ZAP(msg->sum_to, su_msg_destroy);
SU_TASK_ZAP(msg->sum_from, su_msg_destroy);
su_free(NULL, rmsg[0]);
if (msg->sum_deinit)
rmsg[0] = NULL;
su_free(NULL, msg);
/** Gets a pointer to the message data area.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment