[jit] Fix memory leaks in get_gsharedvt_type (). Fixes #16787.