/*++

    Copyright (c) Microsoft Corporation.  All rights reserved.

Rule Name:

    IoFreeIrp

Domain:

    storport

Rule ID:

    Not Applicable

Description:

    This rule verifies that an IRP allocated by IoAllocateIrp either will be freed
    by IoFreeIrp, or its completion routine will get set by IoSetCompletionRoutine.	

Help Link:

    https://go.microsoft.com/fwlink/?LinkId=507217

--*/



#include "ntddk_slic.h"

state {
	enum {INIT, ALLOCATED} s = INIT;
}
watch IoAllocateIrp.exit.$return;

IoAllocateIrp.exit[guard $return]
{  
	if ($return == NULL) {
		halt;
	} else {
		s = ALLOCATED;
	}
}

IoFreeIrp.entry[guard $1]{
	halt;
}

IoSetCompletionRoutine.entry[guard $1]{
	halt;
}

[ALL_SP_CALLBACKS].exit
{
	if (s == ALLOCATED) {
		abort "$fname exited without freeing the IRP that was allocated by IoAllocateIrp.";
	}
}
