thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Advanced

Double Free

Calling free on the same memory twice, which can corrupt the heap allocator and enable code execution.

Definition

Double frees often occur in error-handling paths. They are tracked as CWE-415. Prevent them by nulling pointers after free, clear ownership rules, static analysis and fuzzing with sanitizers.

Example

An error path frees a buffer that the normal cleanup code frees again.

Exam tip

Closely related to use-after-free; both are heap memory-management bugs.

Related terms