Bugfixes.
* mailbox/mime.c (mu_mime_get_num_parts): Assume MIME message is not scanned if nmtp_parts are 0 and boundary is NULL. * mailbox/rfc2047.c (mu_rfc2047_decode): Free the buffer prior to returning a non-zero status. * mailbox/message.c (mu_message_destroy): Install a kludge to work over the slopy ref semantics. * mailbox/auth.c (mu_authority_destroy): Free auth_methods list. * mailbox/locker.c (destroy_dotlock): Free data.dot.nfslock.
Showing
5 changed files
with
24 additions
and
7 deletions
... | @@ -69,6 +69,7 @@ mu_authority_destroy (mu_authority_t *pauthority, void *owner) | ... | @@ -69,6 +69,7 @@ mu_authority_destroy (mu_authority_t *pauthority, void *owner) |
69 | if (authority->owner == owner) | 69 | if (authority->owner == owner) |
70 | { | 70 | { |
71 | mu_ticket_destroy (&authority->ticket); | 71 | mu_ticket_destroy (&authority->ticket); |
72 | mu_list_destroy (&authority->auth_methods); | ||
72 | free (authority); | 73 | free (authority); |
73 | } | 74 | } |
74 | *pauthority = NULL; | 75 | *pauthority = NULL; | ... | ... |
... | @@ -701,6 +701,7 @@ static void | ... | @@ -701,6 +701,7 @@ static void |
701 | destroy_dotlock (mu_locker_t locker) | 701 | destroy_dotlock (mu_locker_t locker) |
702 | { | 702 | { |
703 | free (locker->data.dot.dotlock); | 703 | free (locker->data.dot.dotlock); |
704 | free (locker->data.dot.nfslock); | ||
704 | } | 705 | } |
705 | 706 | ||
706 | #ifndef MAXHOSTNAMELEN | 707 | #ifndef MAXHOSTNAMELEN |
... | @@ -721,7 +722,7 @@ lock_dotlock (mu_locker_t locker, enum mu_locker_mode mode) | ... | @@ -721,7 +722,7 @@ lock_dotlock (mu_locker_t locker, enum mu_locker_mode mode) |
721 | { | 722 | { |
722 | unlink (locker->data.dot.nfslock); | 723 | unlink (locker->data.dot.nfslock); |
723 | free (locker->data.dot.nfslock); | 724 | free (locker->data.dot.nfslock); |
724 | locker->data.dot.nfslock = 0; | 725 | locker->data.dot.nfslock = NULL; |
725 | } | 726 | } |
726 | 727 | ||
727 | expire_stale_lock (locker); | 728 | expire_stale_lock (locker); | ... | ... |
... | @@ -105,7 +105,18 @@ mu_message_destroy (mu_message_t *pmsg, void *owner) | ... | @@ -105,7 +105,18 @@ mu_message_destroy (mu_message_t *pmsg, void *owner) |
105 | int destroy_lock = 0; | 105 | int destroy_lock = 0; |
106 | 106 | ||
107 | mu_monitor_wrlock (monitor); | 107 | mu_monitor_wrlock (monitor); |
108 | msg->ref--; | 108 | /* Note: msg->ref may be incremented by mu_message_ref without |
109 | additional checking for its owner, therefore decrementing | ||
110 | it must also occur independently of the owner checking. Due | ||
111 | to this inconsistency ref may reach negative values, which | ||
112 | is very unfortunate. | ||
113 | |||
114 | The `owner' stuff is a leftover from older mailutils versions. | ||
115 | There is an ongoing attempt to remove it in the stream-cleanup | ||
116 | branch. When it is ready, it will be merged to the HEAD and this | ||
117 | will finally resolve this issue. */ | ||
118 | if (msg->ref > 0) | ||
119 | msg->ref--; | ||
109 | if ((msg->owner && msg->owner == owner) | 120 | if ((msg->owner && msg->owner == owner) |
110 | || (msg->owner == NULL && msg->ref <= 0)) | 121 | || (msg->owner == NULL && msg->ref <= 0)) |
111 | { | 122 | { |
... | @@ -155,8 +166,8 @@ mu_message_destroy (mu_message_t *pmsg, void *owner) | ... | @@ -155,8 +166,8 @@ mu_message_destroy (mu_message_t *pmsg, void *owner) |
155 | if (msg->floating_mailbox && msg->mailbox) | 166 | if (msg->floating_mailbox && msg->mailbox) |
156 | mu_mailbox_destroy (&(msg->mailbox)); | 167 | mu_mailbox_destroy (&(msg->mailbox)); |
157 | */ | 168 | */ |
158 | 169 | ||
159 | if (msg->ref == 0) | 170 | if (msg->ref <= 0) |
160 | free (msg); | 171 | free (msg); |
161 | } | 172 | } |
162 | mu_monitor_unlock (monitor); | 173 | mu_monitor_unlock (monitor); | ... | ... |
... | @@ -930,7 +930,8 @@ mu_mime_get_num_parts (mu_mime_t mime, size_t *nmtp_parts) | ... | @@ -930,7 +930,8 @@ mu_mime_get_num_parts (mu_mime_t mime, size_t *nmtp_parts) |
930 | { | 930 | { |
931 | int ret = 0; | 931 | int ret = 0; |
932 | 932 | ||
933 | if (mime->nmtp_parts == 0 || mime->flags & MIME_PARSER_ACTIVE) | 933 | if ((mime->nmtp_parts == 0 && !mime->boundary) |
934 | || mime->flags & MIME_PARSER_ACTIVE) | ||
934 | { | 935 | { |
935 | if (mu_mime_is_multipart (mime)) | 936 | if (mu_mime_is_multipart (mime)) |
936 | { | 937 | { | ... | ... |
... | @@ -224,8 +224,11 @@ mu_rfc2047_decode (const char *tocode, const char *input, char **ptostr) | ... | @@ -224,8 +224,11 @@ mu_rfc2047_decode (const char *tocode, const char *input, char **ptostr) |
224 | free (fromcode); | 224 | free (fromcode); |
225 | free (encoding_type); | 225 | free (encoding_type); |
226 | free (encoded_text); | 226 | free (encoded_text); |
227 | 227 | ||
228 | *ptostr = realloc (buffer, bufpos); | 228 | if (status) |
229 | free (buffer); | ||
230 | else | ||
231 | *ptostr = realloc (buffer, bufpos); | ||
229 | return status; | 232 | return status; |
230 | } | 233 | } |
231 | 234 | ... | ... |
-
Please register or sign in to post a comment