(message_destroy): (message_destroy): free msg only when decremented ref equals zero.
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -93,7 +93,7 @@ message_destroy (message_t *pmsg, void *owner) | ... | @@ -93,7 +93,7 @@ message_destroy (message_t *pmsg, void *owner) |
93 | { | 93 | { |
94 | destroy_lock = 1; | 94 | destroy_lock = 1; |
95 | /* Notify the listeners. */ | 95 | /* Notify the listeners. */ |
96 | /* FIXME: to be removed since we do not supoort this event. */ | 96 | /* FIXME: to be removed since we do not support this event. */ |
97 | if (msg->observable) | 97 | if (msg->observable) |
98 | { | 98 | { |
99 | observable_notify (msg->observable, MU_EVT_MESSAGE_DESTROY); | 99 | observable_notify (msg->observable, MU_EVT_MESSAGE_DESTROY); |
... | @@ -137,7 +137,7 @@ message_destroy (message_t *pmsg, void *owner) | ... | @@ -137,7 +137,7 @@ message_destroy (message_t *pmsg, void *owner) |
137 | mailbox_destroy (&(msg->mailbox)); | 137 | mailbox_destroy (&(msg->mailbox)); |
138 | */ | 138 | */ |
139 | 139 | ||
140 | if (msg->ref <= 0) | 140 | if (msg->ref == 0) |
141 | free (msg); | 141 | free (msg); |
142 | } | 142 | } |
143 | monitor_unlock (monitor); | 143 | monitor_unlock (monitor); | ... | ... |
-
Please register or sign in to post a comment