The analyzer has detected incorrect code, where an attempt is made to delete an array through the free() or other similar function while no corresponding special functions, such as malloc(), have been used to allocate the memory for this array. This issue leads to undefined behavior.
For example:
class A
{
int x;
int a[50];
public:
A(){}
~A(){ free(a); }
};
Since the memory hasn't been allocated in any special way, it shouldn't be freed by calling special functions either as it will be freed automatically once the object is destroyed. Therefore, the correct code should look like this:
class A
{
int x;
int a[50];
public:
A(){}
~A(){}
};
This diagnostic rule is classified as:
|
You can look at examples of errors detected by the V726 diagnostic. |
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: