forgot to free some memory .. bad.
Showing
3 changed files
with
19 additions
and
4 deletions
... | @@ -82,6 +82,19 @@ ticket_get_owner (ticket_t ticket) | ... | @@ -82,6 +82,19 @@ ticket_get_owner (ticket_t ticket) |
82 | } | 82 | } |
83 | 83 | ||
84 | int | 84 | int |
85 | ticket_set_pop (ticket_t ticket, | ||
86 | int (*_pop) __P ((ticket_t, const char *, char **)), | ||
87 | void *owner) | ||
88 | { | ||
89 | if (ticket == NULL) | ||
90 | return EINVAL; | ||
91 | if (ticket->owner != owner) | ||
92 | return EACCES; | ||
93 | ticket->_pop = _pop; | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | int | ||
85 | ticket_pop (ticket_t ticket, const char *challenge, char **parg) | 98 | ticket_pop (ticket_t ticket, const char *challenge, char **parg) |
86 | { | 99 | { |
87 | if (ticket == NULL || parg == NULL) | 100 | if (ticket == NULL || parg == NULL) | ... | ... |
... | @@ -62,7 +62,8 @@ body_destroy (body_t *pbody, void *owner) | ... | @@ -62,7 +62,8 @@ body_destroy (body_t *pbody, void *owner) |
62 | { | 62 | { |
63 | if (body->file) | 63 | if (body->file) |
64 | fclose (body->file); | 64 | fclose (body->file); |
65 | free (body->filename); | 65 | if (body->filename) |
66 | free (body->filename); | ||
66 | stream_destroy (&(body->stream), body); | 67 | stream_destroy (&(body->stream), body); |
67 | } | 68 | } |
68 | *pbody = NULL; | 69 | *pbody = NULL; | ... | ... |
... | @@ -239,7 +239,7 @@ mbox_destroy (mailbox_t mailbox) | ... | @@ -239,7 +239,7 @@ mbox_destroy (mailbox_t mailbox) |
239 | for (i = 0; i < mud->umessages_count; i++) | 239 | for (i = 0; i < mud->umessages_count; i++) |
240 | { | 240 | { |
241 | mbox_message_t mum = mud->umessages[i]; | 241 | mbox_message_t mum = mud->umessages[i]; |
242 | if (mum == NULL) | 242 | if (mum) |
243 | { | 243 | { |
244 | message_destroy (&(mum->message), mum); | 244 | message_destroy (&(mum->message), mum); |
245 | free (mum); | 245 | free (mum); |
... | @@ -334,13 +334,14 @@ mbox_close (mailbox_t mailbox) | ... | @@ -334,13 +334,14 @@ mbox_close (mailbox_t mailbox) |
334 | { | 334 | { |
335 | mbox_message_t mum = mud->umessages[i]; | 335 | mbox_message_t mum = mud->umessages[i]; |
336 | /* Destroy the attach messages. */ | 336 | /* Destroy the attach messages. */ |
337 | if (mum == NULL) | 337 | if (mum) |
338 | { | 338 | { |
339 | message_destroy (&(mum->message), mum); | 339 | message_destroy (&(mum->message), mum); |
340 | free (mum); | 340 | free (mum); |
341 | } | 341 | } |
342 | } | 342 | } |
343 | free (mud->umessages); | 343 | if (mud->umessages) |
344 | free (mud->umessages); | ||
344 | mud->umessages = NULL; | 345 | mud->umessages = NULL; |
345 | mud->messages_count = mud->umessages_count = 0; | 346 | mud->messages_count = mud->umessages_count = 0; |
346 | mud->size = 0; | 347 | mud->size = 0; | ... | ... |
-
Please register or sign in to post a comment