Commit fedf5655 authored by Bence Béky's avatar Bence Béky Committed by Commit Bot

Clear |name_| and |value_| in spdy::HpackEntry::operator=().

Charlie points out a bug at https://crbug.com/863471#c2: |name_|
and |value_| should be cleared if |other| is of LOOKUP type
but |*this| is not.  This does not cause any leaks or undefined
behavior, but is potentially a waste of memory.

As much as I would love to remove spdy::HpackEntry::operator=()
altogether, this causes the compile to fail on Windows.  Somehow
assignment operator is needed to put HpackEntry in a std::dequeue.
See win_chromium_compile_dbg_ng trybot failures on Patch Set 2.

This CL lands server changes 212433946 and 215208407 by bnc.

BUG=488484

Change-Id: Ia64c9a50232297f333f587c0d68de650d93f77db
Reviewed-on: https://chromium-review.googlesource.com/1252085
Commit-Queue: Bence Béky <bnc@chromium.org>
Commit-Queue: Dianna Hu <diannahu@chromium.org>
Reviewed-by: default avatarDianna Hu <diannahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595499}
parent 4d60b40e
......@@ -53,6 +53,8 @@ HpackEntry& HpackEntry::operator=(const HpackEntry& other) {
insertion_index_ = other.insertion_index_;
type_ = other.type_;
if (type_ == LOOKUP) {
name_.clear();
value_.clear();
name_ref_ = other.name_ref_;
value_ref_ = other.value_ref_;
return *this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment