Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed May 21, 2024
1 parent 2a9118b commit cf1c68e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lsp/src/lsp-diagnostics.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ void lsp_diagnostics_received(GVariant* diags)
lsp_diag->diag_raw = diag;

g_ptr_array_add(arr, lsp_diag);

if (range)
g_variant_unref(range);
}

g_ptr_array_sort(arr, sort_diags);
Expand Down
6 changes: 5 additions & 1 deletion lsp/src/lsp-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ LspTextEdit *lsp_utils_parse_text_edit(GVariant *variant)
ret->range = lsp_utils_parse_range(range);
}

if (range)
g_variant_unref(range);

return ret;
}

Expand Down Expand Up @@ -595,9 +598,10 @@ LspLocation *lsp_utils_parse_location(GVariant *variant)
ret = g_new0(LspLocation, 1);
ret->uri = g_strdup(uri);
ret->range = lsp_utils_parse_range(range);
}

if (range)
g_variant_unref(range);
}

return ret;
}
Expand Down

0 comments on commit cf1c68e

Please sign in to comment.