Commit 80f0d63
tracing: Fix memory leaks in create_field_var()
The function create_field_var() allocates memory for 'val' through
create_hist_field() inside parse_atom(), and for 'var' through
create_var(), which in turn allocates var->type and var->var.name
internally. Simply calling kfree() to release these structures will
result in memory leaks.
Use destroy_hist_field() to properly free 'val', and explicitly release
the memory of var->type and var->var.name before freeing 'var' itself.
Link: https://patch.msgid.link/[email protected]
Fixes: 02205a6 ("tracing: Add support for 'field variables'")
Signed-off-by: Zilin Guan <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>1 parent aa997d2 commit 80f0d63
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3272 | 3272 | | |
3273 | 3273 | | |
3274 | 3274 | | |
3275 | | - | |
| 3275 | + | |
3276 | 3276 | | |
3277 | 3277 | | |
3278 | 3278 | | |
3279 | 3279 | | |
3280 | 3280 | | |
3281 | 3281 | | |
3282 | | - | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
3283 | 3285 | | |
3284 | 3286 | | |
3285 | 3287 | | |
| |||
0 commit comments