diff options
author | David Hill <dhill@cvs.openbsd.org> | 2010-12-16 18:47:02 +0000 |
---|---|---|
committer | David Hill <dhill@cvs.openbsd.org> | 2010-12-16 18:47:02 +0000 |
commit | c4b17b0cf523606f5e60c57d2aa700573daa747e (patch) | |
tree | ec1a6066079141250b7de85461647598aa1ecae6 /lib | |
parent | 886280a1797e8e7bc6cab7e15fe8752310308bbf (diff) |
avoid pointer arithmetic on void *
tested for a while by me.
ok otto@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 566e1e72e6a..8d7d3ae18a6 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.126 2010/10/21 08:09:35 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.127 2010/12/16 18:47:01 dhill Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> * @@ -1159,7 +1159,7 @@ omalloc(size_t sz, int zero_fill) } else { if (mopts.malloc_junk) { if (zero_fill) - memset(p + sz - mopts.malloc_guard, + memset((char *)p + sz - mopts.malloc_guard, SOME_JUNK, psz - sz); else memset(p, SOME_JUNK, @@ -1372,9 +1372,9 @@ orealloc(void *p, size_t newsz) if (rnewsz > roldsz) { if (!mopts.malloc_guard) { STATS_INC(g_pool->cheap_realloc_tries); - zapcacheregion(g_pool, p + roldsz); - q = MMAPA(p + roldsz, rnewsz - roldsz); - if (q == p + roldsz) { + zapcacheregion(g_pool, (char *)p + roldsz); + q = MMAPA((char *)p + roldsz, rnewsz - roldsz); + if (q == (char *)p + roldsz) { malloc_used += rnewsz - roldsz; if (mopts.malloc_junk) memset(q, SOME_JUNK, |