summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-05-28 14:41:20 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-05-28 18:21:58 +0200
commit5ea6e36b2adb4c827d8efc1a75bccf9c3fc1d3a4 (patch)
tree7bd41c90fd5a761c0b4d41a9d2f96779be947ac7
parentcc8b4d5f8728ed79b1dd454415e0b4b3b264e16f (diff)
downloaduxp-5ea6e36b2adb4c827d8efc1a75bccf9c3fc1d3a4.tar.gz
Ensure we AddRef prior to early return in MediaType::Assign.
-rw-r--r--media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp b/media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp
index 54fc2ab7b2..f067094463 100644
--- a/media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/windows/MediaType.cpp
@@ -82,7 +82,10 @@ MediaType::Assign(const AM_MEDIA_TYPE* aMediaType)
Clear();
// Shallow copy.
- memcpy(this, aMediaType, sizeof(AM_MEDIA_TYPE));
+ memcpy(static_cast<AM_MEDIA_TYPE*>(this), aMediaType, sizeof(AM_MEDIA_TYPE));
+
+ if (pUnk)
+ pUnk->AddRef();
// Create deep copy of incoming data...
if (cbFormat) {
@@ -92,9 +95,6 @@ MediaType::Assign(const AM_MEDIA_TYPE* aMediaType)
memcpy(pbFormat, aMediaType->pbFormat, cbFormat);
}
- if (pUnk)
- pUnk->AddRef();
-
return S_OK;
}