Browse Source

Don't forget to fill region from the cache with junk if needed in one case;

from Fabien Romano and Jonathan Armani
OPENBSD_4_7
otto 15 years ago
parent
commit
600b8b9fd5
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/lib/libc/stdlib/malloc.c

+ 3
- 1
src/lib/libc/stdlib/malloc.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: malloc.c,v 1.119 2009/11/27 19:59:49 otto Exp $ */
/* $OpenBSD: malloc.c,v 1.120 2009/11/27 20:05:03 otto Exp $ */
/* /*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net> * Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
* *
@ -520,6 +520,8 @@ map(struct dir_info *d, size_t sz, int zero_fill)
d->free_regions_size -= psz; d->free_regions_size -= psz;
if (zero_fill) if (zero_fill)
memset(p, 0, sz); memset(p, 0, sz);
else if (mopts.malloc_junk && mopts.malloc_freeprot)
memset(p, SOME_FREEJUNK, sz);
return p; return p;
} }
p = MMAP(sz); p = MMAP(sz);


Loading…
Cancel
Save