https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ba5051f7960b8e2275d0…
commit 5ba5051f7960b8e2275d0018d1656438a68cf3a0
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Mon May 24 08:56:17 2021 +0200
Commit: Victor Perevertkin <victor(a)perevertkin.ru>
CommitDate: Tue Dec 28 02:27:50 2021 +0300
[FLTMGR] CreateClientPort(): Fix ObInsertObject() error handling
Avoid extra ObDereferenceObject().
CORE-17904
---
drivers/filters/fltmgr/Messaging.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/filters/fltmgr/Messaging.c b/drivers/filters/fltmgr/Messaging.c
index f4ed276eb4d..713e8fd1770 100644
--- a/drivers/filters/fltmgr/Messaging.c
+++ b/drivers/filters/fltmgr/Messaging.c
@@ -699,10 +699,12 @@ CreateClientPort(_In_ PFILE_OBJECT FileObject,
goto Quit;
}
- /* Now insert the new client port into the object manager*/
- Status = ObInsertObject(ClientPortObject, 0, FLT_PORT_ALL_ACCESS, 1, 0,
(PHANDLE)&PortHandle);
+ /* Now insert the new client port into the object manager */
+ Status = ObInsertObject(ClientPortObject, NULL, FLT_PORT_ALL_ACCESS, 1, NULL,
(PHANDLE)&PortHandle);
if (!NT_SUCCESS(Status))
{
+ /* ObInsertObject() failed and already dereferenced ClientPortObject */
+ ClientPortObject = NULL;
goto Quit;
}