diff --git a/src/shctx.c b/src/shctx.c index fe1b74a7e..ae9cc1f1b 100644 --- a/src/shctx.c +++ b/src/shctx.c @@ -308,6 +308,10 @@ int shctx_init(struct shared_context **orig_shctx, int maxblocks, int blocksize, if (maxblocks <= 0) return 0; + /* make sure to align the records on a pointer size */ + blocksize = (blocksize + sizeof(void *) - 1) & -sizeof(void *); + extra = (extra + sizeof(void *) - 1) & -sizeof(void *); + #ifndef USE_PRIVATE_CACHE if (shared) maptype = MAP_SHARED;