[KS] Cleanup in the failure path of KsCreateDefaultClock. Patch by Sebastian Gasiorek...
authorMark Jansen <mark.jansen@reactos.org>
Sat, 18 Feb 2017 22:54:31 +0000 (22:54 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Sat, 18 Feb 2017 22:54:31 +0000 (22:54 +0000)
svn path=/trunk/; revision=73832

reactos/drivers/ksfilter/ks/clocks.c

index e0cbd86..2a37138 100644 (file)
@@ -395,7 +395,10 @@ KsCreateDefaultClock(
     /* let's allocate the clock struct */
     Clock = AllocateItem(NonPagedPool, sizeof(KSICLOCK));
     if (!Clock)
+    {
+        FreeItem(ClockCreate);
         return STATUS_INSUFFICIENT_RESOURCES;
+    }
 
     /* now allocate the object header */
     Status = KsAllocateObjectHeader((PVOID*)&Clock->ObjectHeader, 0, NULL, Irp, &DispatchTable);
@@ -404,6 +407,7 @@ KsCreateDefaultClock(
     if (!NT_SUCCESS(Status))
     {
         /* failed */
+        FreeItem(ClockCreate);
         FreeItem(Clock);
         return Status;
     }