Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Unified Diff: remoting/protocol/connection_tester.cc

Issue 8930016: Fix valgrind warning in remoting_unittests due to uninitialized memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/connection_tester.cc
diff --git a/remoting/protocol/connection_tester.cc b/remoting/protocol/connection_tester.cc
index 4f8a35e462fbf485334c22aaf42210f172d31904..4b0b4eef596df40f4da2da326b2f550c34b551ce 100644
--- a/remoting/protocol/connection_tester.cc
+++ b/remoting/protocol/connection_tester.cc
@@ -59,6 +59,9 @@ void StreamConnectionTester::Done() {
void StreamConnectionTester::InitBuffers() {
output_buffer_ = new net::DrainableIOBuffer(
new net::IOBuffer(test_data_size_), test_data_size_);
+ for (int i = 0; i < test_data_size_; ++i) {
+ output_buffer_->data()[i] = static_cast<char>(i);
+ }
input_buffer_ = new net::GrowableIOBuffer();
}
@@ -175,7 +178,9 @@ void DatagramConnectionTester::DoWrite() {
}
scoped_refptr<net::IOBuffer> packet(new net::IOBuffer(message_size_));
- memset(packet->data(), 123, message_size_);
+ for (int i = 0; i < message_size_; ++i) {
+ packet->data()[i] = static_cast<char>(i);
+ }
sent_packets_[packets_sent_] = packet;
// Put index of this packet in the beginning of the packet body.
memcpy(packet->data(), &packets_sent_, sizeof(packets_sent_));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698