File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
cpp/ql/src/experimental/Security/CWE/CWE-476 Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
1
...
2
2
try {
3
3
if (checkValue) throw exception ();
4
- valData-> bufMyData = new myData*[valData-> sizeInt ];
4
+ bufMyData = new myData*[sizeInt];
5
5
6
6
}
7
7
catch (...)
8
8
{
9
- for (size_t i = 0 ; i < valData-> sizeInt ; i++)
9
+ for (size_t i = 0 ; i < sizeInt; i++)
10
10
{
11
- delete[] valData-> bufMyData [i]->buffer ; // BAD
12
- delete valData-> bufMyData [i];
11
+ delete[] bufMyData[i]->buffer ; // BAD
12
+ delete bufMyData[i];
13
13
}
14
14
...
15
15
try {
16
16
if (checkValue) throw exception ();
17
- valData-> bufMyData = new myData*[valData-> sizeInt ];
17
+ bufMyData = new myData*[sizeInt];
18
18
19
19
}
20
20
catch (...)
21
21
{
22
- for (size_t i = 0 ; i < valData-> sizeInt ; i++)
22
+ for (size_t i = 0 ; i < sizeInt; i++)
23
23
{
24
- if (valData-> bufMyData [i])
24
+ if (bufMyData[i])
25
25
{
26
- delete[] valData-> bufMyData [i]->buffer ; // GOOD
27
- delete valData-> bufMyData [i];
26
+ delete[] bufMyData[i]->buffer ; // GOOD
27
+ delete bufMyData[i];
28
28
}
29
29
}
30
30
You can’t perform that action at this time.
0 commit comments