Author: tfaber
Date: Fri Mar 31 09:16:45 2017
New Revision: 74246
URL:
http://svn.reactos.org/svn/reactos?rev=74246&view=rev
Log:
[USBEHCI][USBOHCI][USBUHCI]
- Avoid leaking CUSBRequest::m_CompletionEvent. Based on a patch by ReactCoder.
CORE-12984 #resolve
Modified:
trunk/reactos/drivers/usb/usbehci/usb_request.cpp
trunk/reactos/drivers/usb/usbohci/usb_request.cpp
trunk/reactos/drivers/usb/usbuhci/usb_request.cpp
Modified: trunk/reactos/drivers/usb/usbehci/usb_request.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usb_re…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/usb_request.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/usb_request.cpp [iso-8859-1] Fri Mar 31 09:16:45
2017
@@ -56,8 +56,8 @@
VOID DumpQueueHead(IN PQUEUE_HEAD QueueHead);
// constructor / destructor
- CUSBRequest(IUnknown *OuterUnknown){}
- virtual ~CUSBRequest(){}
+ CUSBRequest(IUnknown *OuterUnknown);
+ virtual ~CUSBRequest();
protected:
LONG m_Ref;
@@ -136,6 +136,22 @@
USB_DEVICE_SPEED m_Speed;
};
+
+//----------------------------------------------------------------------------------------
+CUSBRequest::CUSBRequest(IUnknown *OuterUnknown) :
+ m_CompletionEvent(NULL)
+{
+ UNREFERENCED_PARAMETER(OuterUnknown);
+}
+
+//----------------------------------------------------------------------------------------
+CUSBRequest::~CUSBRequest()
+{
+ if (m_CompletionEvent != NULL)
+ {
+ ExFreePoolWithTag(m_CompletionEvent, TAG_USBEHCI);
+ }
+}
//----------------------------------------------------------------------------------------
NTSTATUS
Modified: trunk/reactos/drivers/usb/usbohci/usb_request.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/usb_re…
==============================================================================
--- trunk/reactos/drivers/usb/usbohci/usb_request.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbohci/usb_request.cpp [iso-8859-1] Fri Mar 31 09:16:45
2017
@@ -59,10 +59,9 @@
NTSTATUS BuildTransferDescriptorChain(IN PVOID TransferBuffer, IN ULONG
TransferBufferLength, IN UCHAR PidCode, OUT POHCI_GENERAL_TD * OutFirstDescriptor, OUT
POHCI_GENERAL_TD * OutLastDescriptor, OUT PULONG OutTransferBufferOffset);
VOID InitDescriptor(IN POHCI_GENERAL_TD CurrentDescriptor, IN PVOID TransferBuffer,
IN ULONG TransferBufferLength, IN UCHAR PidCode);
-
// constructor / destructor
- CUSBRequest(IUnknown *OuterUnknown){}
- virtual ~CUSBRequest(){}
+ CUSBRequest(IUnknown *OuterUnknown);
+ virtual ~CUSBRequest();
protected:
LONG m_Ref;
@@ -144,6 +143,22 @@
//
PVOID m_Base;
};
+
+//----------------------------------------------------------------------------------------
+CUSBRequest::CUSBRequest(IUnknown *OuterUnknown) :
+ m_CompletionEvent(NULL)
+{
+ UNREFERENCED_PARAMETER(OuterUnknown);
+}
+
+//----------------------------------------------------------------------------------------
+CUSBRequest::~CUSBRequest()
+{
+ if (m_CompletionEvent != NULL)
+ {
+ ExFreePoolWithTag(m_CompletionEvent, TAG_USBOHCI);
+ }
+}
//----------------------------------------------------------------------------------------
NTSTATUS
Modified: trunk/reactos/drivers/usb/usbuhci/usb_request.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbuhci/usb_re…
==============================================================================
--- trunk/reactos/drivers/usb/usbuhci/usb_request.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbuhci/usb_request.cpp [iso-8859-1] Fri Mar 31 09:16:45
2017
@@ -54,11 +54,9 @@
VOID FreeDescriptor(IN PUHCI_TRANSFER_DESCRIPTOR Descriptor);
NTSTATUS BuildTransferDescriptorChain(IN PVOID TransferBuffer, IN ULONG
TransferBufferLength, IN UCHAR PidCode, IN UCHAR InitialDataToggle, OUT
PUHCI_TRANSFER_DESCRIPTOR * OutFirstDescriptor, OUT PUHCI_TRANSFER_DESCRIPTOR *
OutLastDescriptor, OUT PULONG OutTransferBufferOffset, OUT PUCHAR OutDataToggle);
-
-
// constructor / destructor
- CUSBRequest(IUnknown *OuterUnknown){}
- virtual ~CUSBRequest(){}
+ CUSBRequest(IUnknown *OuterUnknown);
+ virtual ~CUSBRequest();
protected:
LONG m_Ref;
@@ -134,6 +132,22 @@
PVOID m_Base;
};
+
+//----------------------------------------------------------------------------------------
+CUSBRequest::CUSBRequest(IUnknown *OuterUnknown) :
+ m_CompletionEvent(NULL)
+{
+ UNREFERENCED_PARAMETER(OuterUnknown);
+}
+
+//----------------------------------------------------------------------------------------
+CUSBRequest::~CUSBRequest()
+{
+ if (m_CompletionEvent != NULL)
+ {
+ ExFreePoolWithTag(m_CompletionEvent, TAG_USBUHCI);
+ }
+}
//----------------------------------------------------------------------------------------
NTSTATUS