diff options
-rw-r--r-- | chrome_frame/protocol_sink_wrap.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/chrome_frame/protocol_sink_wrap.cc b/chrome_frame/protocol_sink_wrap.cc index eeefbb9..330e300 100644 --- a/chrome_frame/protocol_sink_wrap.cc +++ b/chrome_frame/protocol_sink_wrap.cc @@ -225,10 +225,14 @@ bool IsCFRequest(IBindCtx* pbc) { } void PutProtData(IBindCtx* pbc, ProtData* data) { + // AddRef and Release to avoid a potential leak of a ProtData instance if + // FromBindContext fails. + data->AddRef(); ScopedComPtr<BindContextInfo> info; BindContextInfo::FromBindContext(pbc, info.Receive()); if (info) info->set_prot_data(data); + data->Release(); } bool IsTextHtml(const wchar_t* status_text) { |