CWEweakness

CWE-762 Mismatched Memory Management Routines

Low Official page ↗
Abstraction
Variant
Structure
Simple
Status
Incomplete
Likelihood of exploit
Low
Languages
C, C++, Memory-Unsafe
CWE version
5.0

Description

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.

Common consequences

• Integrity, Availability, Confidentiality: Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands — 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.

Potential mitigations

• [Implementation] 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(). • [Implementation] 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) [REF-391]. 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. • [Architecture and Design] 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. • [Architecture and Design] Use a language that provides abstractions for memory allocation and deallocation.

Detection methods

• 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++ [REF-1518] or valgrind [REF-480].

Observed examples

• CVE-2025-11015: 3D engine rendering backend performs a delete[] on a buffer that was allocated using malloc()

Related

Observed example · CVE (1)

  • CVE-2025-11015 A weakness has been identified in OGRECave Ogre up to 14.4.1. vulnerability

Child of · CWE (2)

  • CWE-404 Improper Resource Shutdown or Release weakness
  • CWE-763 Release of Invalid Pointer or Reference weakness

Referenced by CVE · weakness (14)

  • CVE-2026-102025 A Mismatched Memory Management Routines vulnerability in the routing protocol daemon (rpd) process of Juniper Networks Junos OS and Junos… vulnerability
  • CVE-2026-43622 llama.cpp builds b1886 through b7445 contain a double free vulnerability in the LLaMA-Android JNI wrapper where new_1batch() allocates… vulnerability
  • CVE-2025-48431 Mismatched Memory Management Routines vulnerability in Apache Thrift c_glib language bindings. vulnerability
  • CVE-2025-11015 A weakness has been identified in OGRECave Ogre up to 14.4.1. vulnerability
  • CVE-2025-49080 There is a memory management vulnerability in Absolute Secure Access server versions 9.0 to 13.54. vulnerability
  • CVE-2025-48755 In the spiral-rs crate 0.2.0 for Rust, allocation can be attempted for a ZST (zero-sized type). vulnerability
  • CVE-2025-47737 lib.rs in the trailer crate through 0.1.2 for Rust mishandles allocating with a size of zero. vulnerability
  • CVE-2025-20189 A vulnerability in the Cisco Express Forwarding functionality of Cisco IOS XE Software for Cisco ASR 903 Aggregation Services Routers with… vulnerability
  • CVE-2024-32503 An issue was discovered in Samsung Mobile Processor and Wearable Processor Exynos 850, Exynos 1080, Exynos 2100, Exynos 1280, Exynos 1380,… vulnerability
  • CVE-2024-4853 Memory handling issue in editcap could cause denial of service via crafted capture file vulnerability
  • CVE-2024-2955 T.38 dissector crash in Wireshark 4.2.0 to 4.0.3 and 4.0.0 to 4.0.13 allows denial of service via packet injection or crafted capture file vulnerability
  • CVE-2023-41056 Redis is an in-memory database that persists on disk. vulnerability
  • CVE-2023-45510 tsMuxer version git-2539d07 was discovered to contain an alloc-dealloc-mismatch (operator new [] vs operator delete) error. vulnerability
  • CVE-2023-3648 Kafka dissector crash in Wireshark 4.0.0 to 4.0.6 and 3.6.0 to 3.6.14 allows denial of service via packet injection or crafted capture file vulnerability

Referenced by CWE · child of (1)

  • CWE-590 Free of Memory not on the Heap weakness