Author: janderwald
Date: Fri Sep 23 18:35:15 2016
New Revision: 72779
URL:
http://svn.reactos.org/svn/reactos?rev=72779&view=rev
Log:
[KS]
- make a copy of KSFILTER_DESCRIPTOR as it might have been allocated from the stack
- always initialize object bag in filter factory
Modified:
trunk/reactos/drivers/ksfilter/ks/filterfactory.c
Modified: trunk/reactos/drivers/ksfilter/ks/filterfactory.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/filter…
==============================================================================
--- trunk/reactos/drivers/ksfilter/ks/filterfactory.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/ksfilter/ks/filterfactory.c [iso-8859-1] Fri Sep 23 18:35:15
2016
@@ -238,11 +238,19 @@
/* initialize filterfactory */
This->SleepCallback = SleepCallback;
This->WakeCallback = WakeCallback;
- This->FilterFactory.FilterDescriptor = Descriptor;
This->Header.KsDevice = &DeviceExtension->DeviceHeader->KsDevice;
This->Header.Type = KsObjectTypeFilterFactory;
This->Header.Parent.KsDevice =
&DeviceExtension->DeviceHeader->KsDevice;
This->DeviceHeader = DeviceExtension->DeviceHeader;
+
+ /* copy descriptor */
+ This->FilterFactory.FilterDescriptor = AllocateItem(NonPagedPool,
sizeof(KSFILTER_DESCRIPTOR));
+ if (!This->FilterFactory.FilterDescriptor)
+ {
+ DPRINT("out of memory");
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+ RtlMoveMemory(This->FilterFactory.FilterDescriptor, Descriptor,
sizeof(KSFILTER_DESCRIPTOR));
/* initialize filter factory control mutex */
This->Header.ControlMutex = &This->ControlMutex;
@@ -313,19 +321,19 @@
RtlFreeUnicodeString(&ReferenceString);
}
+ /* create a object bag for the filter factory */
+ This->FilterFactory.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG));
+ if (This->FilterFactory.Bag)
+ {
+ /* initialize object bag */
+ KsDevice =
(IKsDevice*)&DeviceExtension->DeviceHeader->BasicHeader.OuterUnknown;
+ KsDevice->lpVtbl->InitializeObjectBag(KsDevice,
(PKSIOBJECT_BAG)This->FilterFactory.Bag, NULL);
+ }
+
if (FilterFactory)
{
/* return filterfactory */
*FilterFactory = &This->FilterFactory;
-
- /* create a object bag for the filter factory */
- This->FilterFactory.Bag = AllocateItem(NonPagedPool, sizeof(KSIOBJECT_BAG));
- if (This->FilterFactory.Bag)
- {
- /* initialize object bag */
- KsDevice =
(IKsDevice*)&DeviceExtension->DeviceHeader->BasicHeader.OuterUnknown;
- KsDevice->lpVtbl->InitializeObjectBag(KsDevice,
(PKSIOBJECT_BAG)This->FilterFactory.Bag, NULL);
- }
}
/* attach filterfactory to device header */