CWE-763: Release of Invalid Pointer or Reference
The product attempts to return a memory resource to the system, but it calls the wrong release function or calls the appropriate release function incorrectly.
Last updated
The product attempts to return a memory resource to the system, but it calls the wrong release function or calls the appropriate release function incorrectly.
Last updated
The memory was allocated, explicitly or implicitly, via one memory management method and deallocated using a different, non-compatible function (CWE-762).
The function calls or memory management routines chosen are appropriate, however they are used incorrectly, such as in CWE-761.
192 recorded CVEs are caused by CWE-763 (Release of Invalid Pointer or Reference). The highest-severity and most recent are shown first. 93 new CWE-763 CVEs have been recorded so far in 2026 (28 in 2025).
Windows iSCSI Remote Code Execution Vulnerability
um: vector: fix use-after-free in vector_mmsg_rx()
netfilter: nat: use kfree_rcu to release ops
tipc: fix double-free in tipc_buf_append()
ImageMagick vulnerable to Release of Invalid Pointer in BilateralBlur when memory allocation fails
net: macb: fix a memory corruption in extended buffer descriptor mode
net: ethernet: mtk_eth_soc: fix SER panic with 4GB+ RAM
net: esp: fix bad handling of pages from page_pool
libaom: aom_image.c in libaom frees memory that is not located on the heap
Remote code execution in System
Showing 12 of 192 recorded CWE-763 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-763 is exploited.
Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands
Affects: Integrity, Availability, Confidentiality
This weakness may result in the corruption of memory, and perhaps instructions, possibly leading to a crash. If the corrupted memory can be effectively controlled, it may be possible to execute arbitrary code.
Typically introduced during these phases of the software lifecycle.
Languages
Practical mitigations for CWE-763, 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().
When programming in C++, consider using smart pointers provided by the boost library to help correctly and consistently manage memory.
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.
Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
Effectiveness: High
MITRE examples of the weakness in code.
This code attempts to tokenize a string and place it into an array using the strsep function, which inserts a \0 byte in place of whitespace or a tab character. After finishing the loop, each string in the AP array points to a location within the input string.
Vulnerable example
char **ap, *argv[10], *inputstring;
for (ap = argv; (*ap = strsep(&inputstring, " \t")) != NULL;)
if (**ap != '\0')
if (++ap >= &argv[10])
break;
/.../
free(ap[4]);Since strsep is not allocating any new memory, freeing an element in the middle of the array is equivalent to free a pointer in the middle of inputstring.
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 */
...
free(ptr);
}Safe example
void foo(){
BarObj *ptr = new BarObj()
/* do some work with ptr here */
...
delete ptr;
}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 programmer dynamically allocates a buffer to hold a string and then searches for a specific character. After completing the search, the programmer attempts to release the allocated memory and return SUCCESS or FAILURE to the caller. Note: for simplification, this example uses a hard-coded "Search Me!" string and a constant string length of 20.
Vulnerable example
#define SUCCESS (1)
#define FAILURE (0)
int contains_char(char c){
char *str;
str = (char*)malloc(20*sizeof(char));
strcpy(str, "Search Me!");
while( *str != NULL){
if( *str == c ){
/* matched char, free string and return success */
free(str);
return SUCCESS;
}
/* didn't match yet, increment pointer and try next char */
str = str + 1;
}
/* we did not match the char in the string, free mem and return failure */
free(str);
return FAILURE;
}Safe example
#define SUCCESS (1)
#define FAILURE (0)
int contains_char(char c){
char *str;
int i = 0;
str = (char*)malloc(20*sizeof(char));
strcpy(str, "Search Me!");
while( i < strlen(str) ){
if( str[i] == c ){
/* matched char, free string and return success */
free(str);
return SUCCESS;
}
/* didn't match yet, increment pointer and try next char */
i = i + 1;
}
/* we did not match the char in the string, free mem and return failure */
free(str);
return FAILURE;
}Consider the following code in the context of a parsing application to extract commands out of user data. The intent is to parse each command and add it to a queue of commands to be executed, discarding each malformed entry.
Vulnerable example
//hardcode input length for simplicity
char* input = (char*) malloc(40*sizeof(char));
char *tok;
char* sep = " \t";
get_user_input( input );
/* The following loop will parse and process each token in the input string */
tok = strtok( input, sep);
while( NULL != tok ){
if( isMalformed( tok ) ){
/* ignore and discard bad data */
free( tok );
}
else{
add_to_command_queue( tok );
}
tok = strtok( NULL, sep));
}Safe example
//hardcode input length for simplicity
char* input = (char*) malloc(40*sizeof(char));
char *tok, *command;
char* sep = " \t";
get_user_input( input );
/* The following loop will parse and process each token in the input string */
tok = strtok( input, sep);
while( NULL != tok ){
if( !isMalformed( command ) ){
/* copy and enqueue good data */
command = (char*) malloc( (strlen(tok) + 1) * sizeof(char) );
strcpy( command, tok );
add_to_command_queue( command );
}
tok = strtok( NULL, sep));
}
free( input )Real CVEs that MITRE cites as examples of this weakness.
Common questions about CWE-763.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-763 CVE affects your products, with AI-written analysis and remediation steps.