diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 88c4350..98eeba8 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -478,8 +478,13 @@ StateExpectString::custom(gchar chr) if (string_building) machine.reset(); - /* FIXME: possible memleak because of `string`? */ - next = done(string ? : ""); + try { + next = done(string ? : ""); + } catch (...) { + g_free(string); + throw; + } + g_free(string); return next; } @@ -502,7 +507,13 @@ StateExpectString::custom(gchar chr) undo.push_str(strings[0]); String::append(strings[0], insert); - process(strings[0], strlen(insert)); + try { + process(strings[0], strlen(insert)); + } catch (...) { + g_free(insert); + throw; + } + g_free(insert); return this; } |