Instead of using and checking malloc'd error strings formatted with asprintf and passed through a pointer in function arguments, use a global thread-local statically allocated error buffer with functions to set and get it.
This is more efficient, less error-prone, and easier to use than the old method, especially now that NM is larger (meaning that errors are returned through multiple layers) and parts of it are re-used in other things.