Make the key name string a static buffer. The specification allows this, so the previous behaviour would leak a small amount of memory, as the application wouldn't free the returned string. Fixes one part of PR pkg/37062.
Fix use after free().
Ruibiao Qiu.
Fixes PR lib/20033. Allow SMALL to be defined, to reduce the size of the library.