Commit 1d82cc6d 1d82cc6ddba4dff8845cf3ce5a52b8b92ec5f3ab by Sergey Poznyakoff

(message_destroy): (message_destroy): free msg only when decremented ref equals zero.

1 parent 3662b9c4
...@@ -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);
......