Fix a subtle memory leak in the Perl PMDA interface.
It turns out that, for PCP::PMDA, we cannot call Perl code
from C code and expect that the G_DISCARD flag will do our
temporary variable memory cleanup for us. The reason for
this is that, in PCP::PMDA, the main flow of control is not
ever returned to Perl, where such cleanup would be done, as
we sit forever in the PMCD message loop. This is resolved
by explicitly deallocating local temporaries in all places,
not just some, and generally being more clear about where
memory is allocated and deallocated, especially in call sites
where multiple Perl functions may be called from C (fetch).
Fix a subtle memory leak in the Perl PMDA interface.
It turns out that, for PCP::PMDA, we cannot call Perl code
from C code and expect that the G_DISCARD flag will do our
temporary variable memory cleanup for us. The reason for
this is that, in PCP::PMDA, the main flow of control is not
ever returned to Perl, where such cleanup would be done, as
we sit forever in the PMCD message loop. This is resolved
by explicitly deallocating local temporaries in all places,
not just some, and generally being more clear about where
memory is allocated and deallocated, especially in call sites
where multiple Perl functions may be called from C (fetch).