As mentioned in <http://austingroupbugs.net/view.php?id=385>, the next major POSIX release will require 'free' to not set errno. Rich Felker points out some scenarios when glibc 'free' might set errno; see <https://sourceware.org/ml/libc-alpha/2015-02/msg00067.html>. These scenarios should be investigated and fixed.
Also, the glibc documentation should be updated to make it clear to users that glibc 'free' does not set errno, and that any replacements for 'free' should do the same.
*** Bug 22157 has been marked as a duplicate of this bug. ***