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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.cc

Issue 1901593002: Fixed memleak when two voip blocks present in single rtcp packet. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 months 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 24 matching lines...) Expand all
35 ntp_secs(0), 35 ntp_secs(0),
36 ntp_frac(0), 36 ntp_frac(0),
37 rtp_timestamp(0), 37 rtp_timestamp(0),
38 xr_originator_ssrc(0), 38 xr_originator_ssrc(0),
39 xr_dlrr_item(false), 39 xr_dlrr_item(false),
40 VoIPMetric(nullptr) {} 40 VoIPMetric(nullptr) {}
41 41
42 RTCPPacketInformation::~RTCPPacketInformation() 42 RTCPPacketInformation::~RTCPPacketInformation()
43 { 43 {
44 delete [] applicationData; 44 delete [] applicationData;
45 delete VoIPMetric;
46 } 45 }
47 46
48 void 47 void
49 RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric) 48 RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric)
50 { 49 {
51 VoIPMetric = new RTCPVoIPMetric(); 50 VoIPMetric.reset(new RTCPVoIPMetric());
52 memcpy(VoIPMetric, metric, sizeof(RTCPVoIPMetric)); 51 memcpy(VoIPMetric.get(), metric, sizeof(RTCPVoIPMetric));
53 } 52 }
54 53
55 void RTCPPacketInformation::AddApplicationData(const uint8_t* data, 54 void RTCPPacketInformation::AddApplicationData(const uint8_t* data,
56 const uint16_t size) { 55 const uint16_t size) {
57 uint8_t* oldData = applicationData; 56 uint8_t* oldData = applicationData;
58 uint16_t oldLength = applicationLength; 57 uint16_t oldLength = applicationLength;
59 58
60 // Don't copy more than kRtcpAppCode_DATA_SIZE bytes. 59 // Don't copy more than kRtcpAppCode_DATA_SIZE bytes.
61 uint16_t copySize = size; 60 uint16_t copySize = size;
62 if (size > kRtcpAppCode_DATA_SIZE) { 61 if (size > kRtcpAppCode_DATA_SIZE) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 TmmbrSet.Ssrc(sourceIdx)); 184 TmmbrSet.Ssrc(sourceIdx));
186 return 0; 185 return 0;
187 } 186 }
188 187
189 void RTCPReceiveInformation::VerifyAndAllocateBoundingSet( 188 void RTCPReceiveInformation::VerifyAndAllocateBoundingSet(
190 const uint32_t minimumSize) { 189 const uint32_t minimumSize) {
191 TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize); 190 TmmbnBoundingSet.VerifyAndAllocateSet(minimumSize);
192 } 191 }
193 } // namespace RTCPHelp 192 } // namespace RTCPHelp
194 } // namespace webrtc 193 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698