diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-12 11:32:50 +0100 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-15 12:48:29 +0100 |
commit | b02905bdd7555b2016930c2e802f79656bada9fc (patch) | |
tree | bb9b6d09c2d719ded7159775a6d73db3df643b5c /src | |
parent | 78b49ce950b31df8b5ee6788c84b3d439a982d59 (diff) | |
download | rneovim-b02905bdd7555b2016930c2e802f79656bada9fc.tar.gz rneovim-b02905bdd7555b2016930c2e802f79656bada9fc.tar.bz2 rneovim-b02905bdd7555b2016930c2e802f79656bada9fc.zip |
Fix warnings: search.c: find_pattern_in_path(): Np dereference: MI.
Problem : Dereference of null pointer @ 4395.
Diagnostic : Multithreading issue.
Rationale : Problem occurs only if global g_do_tagpreview changed while
funcion is executing.
Resolution : Use local copy of global var.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/search.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/search.c b/src/nvim/search.c index 1e275e9753..bd1811c7fb 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -3973,6 +3973,7 @@ find_pattern_in_path ( char_u *startp = NULL; char_u *inc_opt = NULL; win_T *curwin_save = NULL; + const int l_g_do_tagpreview = g_do_tagpreview; regmatch.regprog = NULL; incl_regmatch.regprog = NULL; @@ -4370,7 +4371,7 @@ search_line: } else if (--count <= 0) { found = TRUE; if (depth == -1 && lnum == curwin->w_cursor.lnum - && g_do_tagpreview == 0 + && l_g_do_tagpreview == 0 ) EMSG(_("E387: Match is on current line")); else if (action == ACTION_SHOW) { @@ -4380,7 +4381,7 @@ search_line: did_show = TRUE; } else { /* ":psearch" uses the preview window */ - if (g_do_tagpreview != 0) { + if (l_g_do_tagpreview != 0) { curwin_save = curwin; prepare_tagpreview(true); } @@ -4391,7 +4392,7 @@ search_line: } if (depth == -1) { /* match in current file */ - if (g_do_tagpreview != 0) { + if (l_g_do_tagpreview != 0) { if (getfile(0, curwin_save->w_buffer->b_fname, NULL, TRUE, lnum, FALSE) > 0) break; /* failed to jump to file */ @@ -4412,7 +4413,7 @@ search_line: curwin->w_set_curswant = TRUE; } - if (g_do_tagpreview != 0 + if (l_g_do_tagpreview != 0 && curwin != curwin_save && win_valid(curwin_save)) { /* Return cursor to where we were */ validate_cursor(); |