Commit 1d87efa
committed
BUG: Make
Originally, a zero-length VariableLengthVector might still have its `m_Data`
pointing to the heap, as it might have its memory allocated by
`new TValue[length]`, with `length == 0`.
A memory leak in `VariableLengthVector(unsigned int length)` was then introduced
by pull request InsightSoftwareConsortium#5710
commit bb79801
"STYLE: Replace AllocateElements calls within VariableLengthVector"
forgetting to `delete` memory that was allocated by `new TValue[0]`.
As was reported by Mihail Isakov, referring to the Valgrind results at
https://open.cdash.org/builds/10917349/dynamic_analysis
With this commit, m_Data should always be null when the VariableLengthVector is
empty and manages its own memory (m_LetArrayManageMemory is `true`).VariableLengthVector::m_Data null when its length is zero1 parent f3697ed commit 1d87efa
File tree
2 files changed
+28
-25
lines changed- Modules/Core/Common/include
2 files changed
+28
-25
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
273 | | - | |
274 | 273 | | |
275 | | - | |
276 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
277 | 280 | | |
278 | 281 | | |
279 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
| 34 | + | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
43 | | - | |
| 40 | + | |
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
| |||
67 | 64 | | |
68 | 65 | | |
69 | 66 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 67 | | |
75 | 68 | | |
76 | 69 | | |
| |||
133 | 126 | | |
134 | 127 | | |
135 | 128 | | |
136 | | - | |
137 | | - | |
138 | 129 | | |
139 | 130 | | |
140 | 131 | | |
| |||
191 | 182 | | |
192 | 183 | | |
193 | 184 | | |
194 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
195 | 190 | | |
196 | 191 | | |
197 | 192 | | |
198 | | - | |
199 | 193 | | |
200 | 194 | | |
201 | 195 | | |
| |||
274 | 268 | | |
275 | 269 | | |
276 | 270 | | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
281 | 280 | | |
282 | 281 | | |
283 | 282 | | |
| |||
293 | 292 | | |
294 | 293 | | |
295 | 294 | | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| |||
0 commit comments