History

tracing/synthetic: Free type string on error path

parse_synth_field() builds a "__data_loc ..." type string before assigning it to field->type. If the seq_buf check fails, the common cleanup cannot free the temporary string. Free it before leaving.

Yu Peng committed 5 months ago

Commit 05074bb1 parent 50fd6dd1 file · +3 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/trace/trace_events_synth.c+3−1
@@ -839,8 +839,10 @@ static struct synth_field *parse_synth_field(int argc, char **argv, · 838 unmodified lines
839 seq_buf_puts(&s, "__data_loc ");839 seq_buf_puts(&s, "__data_loc ");
840 seq_buf_puts(&s, field->type);840 seq_buf_puts(&s, field->type);
841 841
842 if (WARN_ON_ONCE(!seq_buf_buffer_left(&s)))842 if (WARN_ON_ONCE(!seq_buf_buffer_left(&s))) {
843 kfree(type);
843 goto free;844 goto free;
845 }
844 s.buffer[s.len] = '\0';846 s.buffer[s.len] = '\0';
845 847
846 kfree(field->type);848 kfree(field->type);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t