Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 2014 19:28:37 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        Andrey Chernov <ache@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Pedro F. Giffuni" <pfg@FreeBSD.org>, src-committers@freebsd.org
Subject:   Re: svn commit: r265367 - head/lib/libc/regex
Message-ID:  <B11B5B25-8E05-4225-93D5-3A607332F19A@FreeBSD.org>
In-Reply-To: <5367CD77.40909@freebsd.org>
References:  <201405051641.s45GfFje086423@svn.freebsd.org> <5367CD77.40909@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 May 2014, at 18:42, Andrey Chernov <ache@freebsd.org> wrote:

> Please don't commit OpenBSD errors. Now you mix calloc() with the
> realloc() for the same variable later which makes calloc() zeroing
> pointless and waste of CPU.

The purpose of calloc() here is not (primarily) to get the zero'd size, =
it's to get the overflow-checking behaviour for calloc. =20

The uses of realloc() later do still potentially overflow, as they =
follow the realloc(pointer, size * sizeof(type)) antipattern. =20

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B11B5B25-8E05-4225-93D5-3A607332F19A>