HomeFreeBSD

grep: don't rely on implementation-defined malloc(0) behavior

Description

grep: don't rely on implementation-defined malloc(0) behavior

The very few places that rely on malloc/calloc of a zero-size region
won't attempt to dereference it, so just return NULL rather than rolling
the dice with the underlying malloc implementation.

Reported by: brooks, Shawn Webb

(cherry picked from commit e116e040f3091eca914a06dcd0bdd9f1aea23add)

Details

Provenance
kevansAuthored on Nov 5 2023, 2:08 AM
Parents
rGd416cca27a23: install: handle -m +X more accurately
Branches
Unknown
Tags
Unknown