Intel® Inspector User Guide for Windows* OS

ID 767798
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Invalid Deallocation

Occurs when an application calls a deallocation function with an address that does not correspond to dynamically allocated memory.

ID

Code location

Description

1

Invalid deallocation site

Represents the location from which the invalid call to a deallocation function was made.

C Examples/Windows* OS

int x = 1;
int *p = &x;
VirtualFree(p, 1, MEM_DECOMMIT);

void *p = VirtualAlloc(NULL,1,MEM_COMMIT,PAGE_READWRITE);
VirtualFree(p,1,MEM_DECOMMIT);
VirtualFree(p,1,MEM_DECOMMIT);
C Example/Linux* OS

void *p = mmap(NULL, 8, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
munmap(p, 8);
munmap(p, 8);
Possible Correction Strategies

If

Do This

This code location should free memory.

Change the code to pass in dynamically allocated memory.

This code location does not need to free memory.

Remove the call to the deallocation function.