don't leak resources on failure
authorThomas Bluemel <thomas@reactsoft.com>
Sat, 22 Jan 2005 20:59:49 +0000 (20:59 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Sat, 22 Jan 2005 20:59:49 +0000 (20:59 +0000)
svn path=/trunk/; revision=13220

reactos/ntoskrnl/rtl/capture.c

index 8f18a79..a634fa3 100644 (file)
@@ -115,6 +115,13 @@ RtlCaptureUnicodeString(OUT PUNICODE_STRING Dest,
       Status = _SEH_GetExceptionCode();
     }
     _SEH_END;
+    
+    if(!NT_SUCCESS(Status))
+    {
+      ExFreePool(Dest->Buffer);
+      Dest->Buffer = NULL;
+      Dest->Length = Dest->MaximumLength = 0;
+    }
   }
   else
   {