diff --git a/src/rencache.c b/src/rencache.c index 4997687c..c3254cd0 100644 --- a/src/rencache.c +++ b/src/rencache.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "rencache.h" @@ -84,6 +85,8 @@ static RenRect merge_rects(RenRect a, RenRect b) { static Command* push_command(int type, int size) { + size_t alignment = alignof(max_align_t) - 1; + size = (size + alignment) & ~alignment; Command *cmd = (Command*) (command_buf + command_buf_idx); int n = command_buf_idx + size; if (n > COMMAND_BUF_SIZE) {