...
Only free a pointer to dynamic memory referred to by x once. This can be accomplished in this example by removing the call to free()
in the section of code executed when error_condition
is true.
Code Block |
---|
*x = malloc (number * sizeof(int)); |
...
if (x == NULL) { |
...
/* Handle Allocation Error */ |
...
} |
...
if (error_conditon == 1) { |
...
/* Handle Error Condition*/ |
...
} |
...
/* ... */ |
...
free |
...
(x); |
References
VU#623332, http://www.kb.cert.org/vuls/id/623332