CWE-762: Mismatched Memory Management Routines
The product attempts to return a memory resource to the system, but it calls a release function that is not compatible with the function that was originally used to allocate that resource.
Last updated
Overview
This weakness can be generally described as mismatching memory management routines, such as: The memory was allocated on the stack (automatically), but it was deallocated using the memory management routine free() (CWE-590), which is intended for explicitly allocated heap memory. The memory was allocated explicitly using one set of memory management functions, and deallocated using a different set. For example, memory might be allocated with malloc() in C++ instead of the new operator, and then deallocated with the delete operator. When the memory management functions are mismatched, the consequences may be as severe as code execution, memory corruption, or program crash. Consequences and ease of exploit will vary depending on the implementation of the routines and the object being managed.
Real-world CVEs
13 recorded CVEs are caused by CWE-762 (Mismatched Memory Management Routines). The highest-severity and most recent are shown first. 3 new CWE-762 CVEs have been recorded so far in 2026 (4 in 2025).
- CVE-2025-48755Critical · CVSS 9.8 · EPSS 29th2025-05-24
- CVE-2025-47737
trailer mishandles allocating with a size of zero
Critical · CVSS 9.8 · EPSS 46th2025-05-09 - CVE-2026-102025
Junos OS and Junos OS Evolved: A BGP route-processing error causes rpd crash when extended next-hop tunneling and SRv6 service processing are used
High · CVSS 8.7 · EPSS 40th2026-10-14 - CVE-2025-49080
Memory management vulnerability in Absolute Secure Access server versions 9.0 to 13.54
High · CVSS 8.7 · EPSS 31th2025-06-12 - CVE-2026-43622
llama.cpp b1886–b7445 Double Free via llama-android.cpp
High · CVSS 8.5 · EPSS 14th2026-08-06 - CVE-2024-32503High · CVSS 8.4 · EPSS 10th2024-06-07
- CVE-2023-41056
Redis vulnerable to integer overflow in certain payloads
High · CVSS 8.1 · EPSS 85th2024-01-10 - CVE-2024-2955
Mismatched Memory Management Routines in Wireshark
High · CVSS 7.8 · EPSS 73th2024-03-26 - CVE-2025-48431
Apache Thrift: Specially crafted input can crash a c_glib Thrift server with invalid pointer error.
High · CVSS 7.5 · EPSS 64th2026-04-28 - CVE-2023-45510High · CVSS 7.5 · EPSS 54th2023-10-12
- CVE-2025-20189High · CVSS 7.4 · EPSS 16th2025-05-07
- CVE-2024-4853
Mismatched Memory Management Routines in editcap
Medium · CVSS 5.5 · EPSS 36th2024-05-14
Showing 12 of 13 recorded CWE-762 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsCommon consequences
What can happen when CWE-762 is exploited.
Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands
Affects: Integrity, Availability, Confidentiality
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
Applies to
Languages
How to prevent it
Practical mitigations for CWE-762, grouped by where in the lifecycle they apply.
Only call matching memory management functions. Do not mix and match routines. For example, when you allocate a buffer with malloc(), dispose of the original pointer with free().
Choose a language or tool that provides automatic memory management, or makes manual memory management less error-prone.
For example, glibc in Linux provides protection against free of invalid pointers.
When using Xcode to target OS X or iOS, enable automatic reference counting (ARC) [3].
To help correctly and consistently manage memory when programming in C++, consider using a smart pointer class such as std::auto_ptr (defined by ISO/IEC ISO/IEC 14882:2003), std::shared_ptr and std::unique_ptr (specified by an upcoming revision of the C++ standard, informally referred to as C++ 1x), or equivalent solutions such as Boost.
Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
For example, glibc in Linux provides protection against free of invalid pointers.
Use a language that provides abstractions for memory allocation and deallocation.
How to detect it
Code examples
MITRE examples of the weakness in code.
This example allocates a BarObj object using the new operator in C++, however, the programmer then deallocates the object using free(), which may lead to unexpected behavior.
Vulnerable example
void foo(){
BarObj *ptr = new BarObj()
/* do some work with ptr here */Safe example
void foo(){
BarObj *ptr = new BarObj()
/* do some work with ptr here */Instead, the programmer should have either created the object with one of the malloc family functions, or else deleted the object with the delete operator.
In this example, the program does not use matching functions such as malloc/free, new/delete, and new[]/delete[] to allocate/deallocate the resource.
Vulnerable example
class A {
void foo();
int *ptr;In this example, the program calls the delete[] function on non-heap memory.
Vulnerable example
class A{
void foo(bool);
int localArray[2] = {
11,22
p = new int[2];Terminology & mappings
Mapped taxonomies
- CERT C Secure Coding: Properly pair allocation and deallocation functions (WIN30-C) — Exact fit
- Software Fault Patterns: Faulty Memory Release (SFP12)
Frequently asked questions
Common questions about CWE-762.
- What is CWE-762?
- The product attempts to return a memory resource to the system, but it calls a release function that is not compatible with the function that was originally used to allocate that resource.
- What CVEs are caused by CWE-762?
- 13 recorded CVEs are attributed to CWE-762, including CVE-2025-48755, CVE-2025-47737 and CVE-2026-102025.
- How do you prevent CWE-762?
- Only call matching memory management functions. Do not mix and match routines. For example, when you allocate a buffer with malloc(), dispose of the original pointer with free().
- How is CWE-762 detected?
- Automated Dynamic Analysis: Use tools that are integrated during compilation to insert runtime error-checking mechanisms related to memory safety errors, such as AddressSanitizer (ASan) for C/C++ or valgrind.
- What are the consequences of CWE-762?
- Exploiting CWE-762 can lead to: Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands.
- Is CWE-762 actively exploited?
- 13 recorded CVEs are caused by CWE-762; none are currently in CISA's KEV catalog of actively exploited flaws.
Sources
References
- MITRE CWE definition (CWE-762) (opens in a new tab)
- CWE-762 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Track CWE-762 CVEs
Get an alert when a new CWE-762 CVE affects your products, with AI-written analysis and remediation steps.