Commit 0d7b50c
committed
testsuite: Prefer _cleanup_free_ to free temp storage
`preload` is freed in all exit paths, just use _cleanup_free_ to avoid
bugs like the one fixed in commit e1d21ab ("testsuite: Fix memory
leak in test_export_environ error paths").
As noted by Emil, there's one place where the free() can't be removed:
when we are replacing what preload points to. Keep that one, zap the
rest.
Link: #423
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>1 parent 69c8cf9 commit 0d7b50c
1 file changed
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | 191 | | |
193 | 192 | | |
194 | 193 | | |
| |||
209 | 208 | | |
210 | 209 | | |
211 | 210 | | |
212 | | - | |
213 | 211 | | |
214 | 212 | | |
215 | 213 | | |
| |||
223 | 221 | | |
224 | 222 | | |
225 | 223 | | |
226 | | - | |
227 | | - | |
228 | 224 | | |
229 | 225 | | |
230 | 226 | | |
| |||
0 commit comments