HomeFreeBSD

Simplify cleanup on failure in realpath(3).

Description

Simplify cleanup on failure in realpath(3).

If realpath() allocated memory for result and failed, the memory is
freed in each place where return is performed. More, the function
needs to track the allocation status, to not free user-supplied
buffer.

Consolidate the memory handling in the wrapper, freeing the buffer if
the actual worker failed.

Reviewed by: emaste (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D10670

Details

Provenance
kibAuthored on
Reviewer
emaste
Differential Revision
D10670: Simplify cleanup on failure in realpath(3).
Parents
rS318298: Fix several buffer overflows in realpath(3).
Branches
Unknown
Tags
Unknown