diff --git a/dix/swaprep.c b/dix/swaprep.c index d785b2e5e..e9be90852 100644 --- a/dix/swaprep.c +++ b/dix/swaprep.c @@ -48,6 +48,8 @@ SOFTWARE. #include #endif +#include + #include #include #include "misc.h" @@ -95,6 +97,8 @@ CopySwap32Write(ClientPtr pClient, int size, CARD32 *pbuf) CARD32 *from, *to, *fromLast, *toLast; CARD32 tmpbuf[1]; + assert((bufsize % sizeof(CARD32)) == 0); + /* Allocate as big a buffer as we can... */ while (!(pbufT = malloc(bufsize))) { bufsize >>= 1; @@ -142,6 +146,8 @@ CopySwap16Write(ClientPtr pClient, int size, short *pbuf) short *from, *to, *fromLast, *toLast; short tmpbuf[2]; + assert((bufsize % sizeof(short)) == 0); + /* Allocate as big a buffer as we can... */ while (!(pbufT = malloc(bufsize))) { bufsize >>= 1;