Don't allocate a buffer to return a reference to a tuple element
authorMatt Corallo <git@bluematt.me>
Tue, 19 Oct 2021 06:24:54 +0000 (06:24 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 19 Oct 2021 06:24:54 +0000 (06:24 +0000)
commita5a3be43417f70953e7b56b0d82e8a1c774798d0
tree4b8b2af6e051b65a9d5066b59cd8443d6c89f609
parenta73b1505c13ef3c03fba20f3d4845f32e762724a
Don't allocate a buffer to return a reference to a tuple element

If we're returning a reference to an object because we don't have a
clone function available, we'll set the reference flag implying no
free'ing will occur. In that case, we don't need to allocate a
buffer to copy the object's memory, we might as well just return a
pointer to the original.

After this commit, test leaks are:
    73 allocations remained for 1137376 bytes.
gen_type_mapping.py