Skip to content
uencoder

Double Free

A double free is calling free twice on the same pointer, corrupting heap metadata and potentially enabling arbitrary writes or crashes.

Purpose

To understand the damage a double free inflicts on the heap manager and its defenses; a common memory-safety defect.

Mechanism

On the second free of the same pointer, the heap manager inserts the already-freed block into the free list again, creating cycles or overlapping chunks, so later malloc may return overlapping memory. Defenses: null the pointer, reference counting.

Use cases

  • Heap security analysis
  • Memory management audit
  • C/C++ security

Related tools

References