---
title: Deallocation of deallocated memory
framework: xcode
role: article
role_heading: Article
path: xcode/deallocation-of-deallocated-memory
---

# Deallocation of deallocated memory

Detects attempts to free deallocated memory.

## Overview

Overview Use this check to detect when you call free on deallocated memory, commonly referred to as a double free error. Attempting to deallocate memory more than once can result in a crash or other unpredictable behavior. Available in Xcode 7 and later. Deallocation of freed memory in C In the following example, the code deallocates the p_int variable after the call to free its memory: int *pointer = malloc(sizeof(int)); free(pointer); free(pointer); // Error: free called twice with the same memory address  Solution Ensure that you call the free function just once for memory you allocate.

## See Also

### Address Sanitizer

- [Use of deallocated memory](xcode/use-of-deallocated-memory.md)
- [Deallocation of nonallocated memory](xcode/deallocation-of-nonallocated-memory.md)
- [Use of stack memory after function return](xcode/use-of-stack-memory-after-function-return.md)
- [Use of out-of-scope stack memory](xcode/use-of-out-of-scope-stack-memory.md)
- [Overflow and underflow of buffers](xcode/overflow-and-underflow-of-buffers.md)
- [Overflow of C++ containers](xcode/overflow-of-c-containers.md)
