diff --git a/dlls/msxml3/xmlelem.c b/dlls/msxml3/xmlelem.c
index bd3c8a67806..787b13fcce8 100644
--- a/dlls/msxml3/xmlelem.c
+++ b/dlls/msxml3/xmlelem.c
@@ -356,6 +356,9 @@ static HRESULT WINAPI xmlelem_put_text(IXMLElement *iface, BSTR p)
 
     content = xmlChar_from_wchar(p);
     xmlNodeSetContent(This->node, content);
+
+    HeapFree( GetProcessHeap(), 0, content);
+
     return S_OK;
 }