Sensitive data? memset(p, 0, sz); free(p); does not do want you think it does. The compiler is allowed to optimise the memset away. Use freezero(p, sz). For large allocations #OpenBSD just unmaps the pages, avoiding the clearing and still making the memory inaccessible.

Follow

@otto nice! But but but, shouldn't it be called cfree()? ;) Speaking of which - guessing that the analog holds for calloc()?

Sign in to participate in the conversation
chaos.social

chaos.social – a Fediverse instance for & by the Chaos community