Backport 7734
[*] Made a backport of changes from master branch related to fixing memory leaks when extracting emission datums from the chain.
[*] Made a backport of changes from master branch related to fixing memory leaks when extracting emission datums from the chain.