summaryrefslogtreecommitdiff
path: root/ide-autocomplete.c
diff options
context:
space:
mode:
Diffstat (limited to 'ide-autocomplete.c')
-rw-r--r--ide-autocomplete.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ide-autocomplete.c b/ide-autocomplete.c
index 0ad78ed..6089818 100644
--- a/ide-autocomplete.c
+++ b/ide-autocomplete.c
@@ -399,6 +399,7 @@ void autocomplete_process_lsp_response(Ted *ted, const LSPResponse *response) {
// only show phantom if there is exactly 1 possible completion.
if (ncandidates == 1) {
+ free(ac->phantom);
ac->phantom = str_dup(candidate);
} else {
autocomplete_clear_phantom(ac);
@@ -429,6 +430,7 @@ void autocomplete_process_lsp_response(Ted *ted, const LSPResponse *response) {
}
if (ac->last_request_phantom) {
assert(ncompletions == 1);
+ free(ac->phantom);
ac->phantom = str_dup(ac->completions[0].text);
autocomplete_clear_completions(ac);
return;