Skip to content

Commit

Permalink
fix logic for growing mailbox memory
Browse files Browse the repository at this point in the history
  • Loading branch information
jpalus committed Oct 29, 2023
1 parent 7a3ce1e commit 9b60f2a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,10 +1242,12 @@ int mx_msg_close(struct Mailbox *m, struct Message **ptr)
*/
void mx_alloc_memory(struct Mailbox *m, int req_size)
{
if ((req_size + 1) <= m->email_max)
return;

const int grow = 25;

// Sanity checks
req_size = MAX(req_size, m->email_max);
req_size = ROUND_UP(req_size + 1, grow);

const size_t s = MAX(sizeof(struct Email *), sizeof(int));
Expand Down

0 comments on commit 9b60f2a

Please sign in to comment.