[PATCH] tracing: Fix use-after-free and double-free on last_cmd