mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
[NTOS:WMI] Be consistent about potential NULL pointer use
This commit is contained in:
parent
17a9041da1
commit
d18634c026
1 changed files with 13 additions and 8 deletions
|
@ -108,21 +108,26 @@ NTSTATUS
|
|||
NTAPI
|
||||
IoWMIWriteEvent(_Inout_ PVOID WnodeEventItem)
|
||||
{
|
||||
DPRINT1("IoWMIWriteEvent() called for WnodeEventItem %p (Flags = 0x%08lx), returning success\n",
|
||||
WnodeEventItem, ((PWNODE_HEADER)WnodeEventItem)->Flags);
|
||||
PWNODE_HEADER Header = WnodeEventItem;
|
||||
|
||||
if (((PWNODE_HEADER)WnodeEventItem)->Flags & WNODE_FLAG_TRACED_GUID)
|
||||
if(!Header)
|
||||
{
|
||||
DPRINT("IoWMIWriteEvent(): Flags has WNODE_FLAG_TRACED_GUID\n");
|
||||
DPRINT1("Got NULL Item!\n");
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DPRINT1("IoWMIWriteEvent() called for WnodeEventItem %p (Flags = 0x%08lx), returning success\n",
|
||||
WnodeEventItem, Header->Flags);
|
||||
|
||||
if (Header->Flags & WNODE_FLAG_TRACED_GUID)
|
||||
{
|
||||
// Never free WnodeEventItem in this case.
|
||||
|
||||
DPRINT("IoWMIWriteEvent(): Flags has WNODE_FLAG_TRACED_GUID\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Free the buffer if we are returning success */
|
||||
if (WnodeEventItem != NULL)
|
||||
ExFreePool(WnodeEventItem);
|
||||
ExFreePool(WnodeEventItem);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
@ -402,7 +407,7 @@ WmiStartTrace(IN OUT PWMI_LOGGER_INFORMATION LoggerInfo)
|
|||
UNIMPLEMENTED;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
WmiStopTrace(IN PWMI_LOGGER_INFORMATION LoggerInfo)
|
||||
|
|
Loading…
Reference in a new issue