Skip to content

Commit

Permalink
user-sentence-dictionary: Fix memleak
Browse files Browse the repository at this point in the history
Similar to commit 7d365e1.
  • Loading branch information
ueno committed Jun 19, 2018
1 parent 8fea75f commit 1a3e029
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libkkc/user-sentence-dictionary.vala
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,13 @@ namespace Kkc {
// Newer valac thinks null in a fixed length array as an
// empty string.
var array = input.to_array ();
// Change length of strv may make vala no able to free it
// correctly. Save the length and restore it later.
var old_length = array.length;
array.length = -1;
constraint_entries.set (string.joinv ("", array), constraint);
phrase_entries.set (string.joinv (" ", array), phrase);
array.length = old_length;
is_dirty = true;
return true;
}
Expand Down

0 comments on commit 1a3e029

Please sign in to comment.