Ensure we AddRef prior to early return in MediaType::Assign.

master
Fedor 2019-06-12 13:44:25 +03:00
parent bec3f9ab93
commit 2af9198eba
1 changed files with 4 additions and 4 deletions

View File

@ -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;
}