From 5e1625ed2d0d963f415938b21583ac2b0a9eb82a Mon Sep 17 00:00:00 2001 From: "kjellander@webrtc.org" Date: Fri, 20 Jan 2012 08:40:55 +0000 Subject: [PATCH] Fixing Valgrind problem detected by video_processing_unittests. Simple initialization of the allocated memory for the image buffer avoids reading uninitialized data in some special cases. This fix is only intended for Linux, since the test is known to fail on Windows. But since we're currently only running Valgrind on Linux, this will give us improved control over memory issues. BUG= TEST=tools/valgrind-webrtc/webrtc_tests.sh -t cmdline out/Debug/video_processing_unittests Review URL: http://webrtc-codereview.appspot.com/349012 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1493 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/modules/interface/module_common_types.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/interface/module_common_types.h b/src/modules/interface/module_common_types.h index 22d68652f7..ef38374c05 100644 --- a/src/modules/interface/module_common_types.h +++ b/src/modules/interface/module_common_types.h @@ -564,10 +564,14 @@ VideoFrame::VerifyAndAllocate(const WebRtc_UWord32 minimumSize) memcpy(newBufferBuffer, _buffer, _bufferSize); delete [] _buffer; } + else + { + memset(newBufferBuffer, 0, minimumSize * sizeof(WebRtc_UWord8)); + } _buffer = newBufferBuffer; _bufferSize = minimumSize; } - return 0; + return 0; } inline