Fixed "Resource leak" #14251#coverity
Fixed "Free of address-of expression" #14176#coverity.

Prevented deleting pointer to local variable.