fix possible use-after-free during incremental search

adapted from
https://git.gnome.org/browse/gedit/commit/?id=f8508ca201e7d16fa5e18a6130f456fdd3fc0c99
This commit is contained in:
monsta 2015-12-25 11:58:58 +03:00
parent 25f5476b07
commit fa1422db50
1 changed files with 1 additions and 2 deletions

View File

@ -1627,12 +1627,11 @@ init_search_entry (PlumaView *view)
guint old_find_flags = 0; guint old_find_flags = 0;
gint sel_len = 0; gint sel_len = 0;
g_free (view->priv->old_search_text);
old_find_text = pluma_document_get_search_text (PLUMA_DOCUMENT (buffer), old_find_text = pluma_document_get_search_text (PLUMA_DOCUMENT (buffer),
&old_find_flags); &old_find_flags);
if (old_find_text != NULL) if (old_find_text != NULL)
{ {
g_free (view->priv->old_search_text);
view->priv->old_search_text = old_find_text; view->priv->old_search_text = old_find_text;
add_search_completion_entry (old_find_text); add_search_completion_entry (old_find_text);
} }