Fixed a memory leak!

(cherry picked from commit 76f8061ce4ee4ee3937f7d46e98c3c1cd9883a45)