args: Improve management of allocated array memory
Based on !857 (merged) adding more fixes after testing gobject-introspection!407 which caused various issues to show up.
Basically, handle better the arrays memory.
Closes: #562 (closed), #561 (closed), #553 (closed) Helps with: #560 (closed)
Edited by Marco Trevisan