summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 20:07:48 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-30 20:07:48 +0000
commit3fd7c8635218cffbf3780810b935cd06d9b1ff1a (patch)
treece12ddad94679e98ee7442a985f4a5664a5873d6 /chrome_frame
parentde8fdf2884a452b35e0811252409955d2e5d002f (diff)
downloadchromium_src-3fd7c8635218cffbf3780810b935cd06d9b1ff1a.zip
chromium_src-3fd7c8635218cffbf3780810b935cd06d9b1ff1a.tar.gz
chromium_src-3fd7c8635218cffbf3780810b935cd06d9b1ff1a.tar.bz2
Handle a case if BindContextInfo::FromBindContext fails and not leak a ProtData instance.
BUG=none TEST=fixes a potential memory leak. Review URL: http://codereview.chromium.org/2832097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54366 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/protocol_sink_wrap.cc4
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) {