When tracecmd_msg_wait_for_cmd() returns successfully, msg->buf isn't freed. Call msg_free() to free it. Signed-off-by: Jerome Marchand <jmarchan@xxxxxxxxxx> --- lib/trace-cmd/trace-msg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/trace-cmd/trace-msg.c b/lib/trace-cmd/trace-msg.c index f5c604f1..c7583587 100644 --- a/lib/trace-cmd/trace-msg.c +++ b/lib/trace-cmd/trace-msg.c @@ -1034,8 +1034,10 @@ static int tracecmd_msg_wait_for_cmd(struct tracecmd_msg_handle *msg_handle, enu if (ret < 0) goto error; - if (ntohl(msg.hdr.cmd) == cmd) + if (ntohl(msg.hdr.cmd) == cmd) { + msg_free(&msg); return 0; + } error_operation(&msg); ret = handle_unexpected_msg(msg_handle, &msg); -- 2.47.0