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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -839,8 +839,10 @@ static struct synth_field *parse_synth_field(int argc, char **argv, · 838 unmodified lines | ||
| 839 | 839 | seq_buf_puts(&s, "__data_loc "); |
| 840 | 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 | 844 | goto free; |
| 845 | + } | |
| 844 | 846 | s.buffer[s.len] = '\0'; |
| 845 | 847 | |
| 846 | 848 | kfree(field->type); |