From e7e30f1c86d978131a5f4c6e62b5b8d822696cd1 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 22 Jul 2014 22:52:57 +0200 Subject: [PATCH] fixed memory leak in fsm_opt --- passes/fsm/fsm_opt.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/passes/fsm/fsm_opt.cc b/passes/fsm/fsm_opt.cc index 367b38eb1..d5a9b71fa 100644 --- a/passes/fsm/fsm_opt.cc +++ b/passes/fsm/fsm_opt.cc @@ -44,8 +44,10 @@ struct FsmOpt char *str = strdup(wire->attributes["\\unused_bits"].decode_string().c_str()); for (char *tok = strtok(str, " "); tok != NULL; tok = strtok(NULL, " ")) { - if (tok[0] && bit == atoi(tok)) + if (tok[0] && bit == atoi(tok)) { + free(str); return true; + } } free(str); -- 2.30.2