diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-14 21:26:24 +0100 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2014-11-18 21:57:47 +0100 |
commit | 3f420ce0d829a8cdff9d55f6178989ca8e0406c9 (patch) | |
tree | b493abc9ff3b8636406e0b30940c8df599364087 /src | |
parent | 04e42f2ae409294d551c9b589aee4cbfd2616d68 (diff) | |
download | rneovim-3f420ce0d829a8cdff9d55f6178989ca8e0406c9.tar.gz rneovim-3f420ce0d829a8cdff9d55f6178989ca8e0406c9.tar.bz2 rneovim-3f420ce0d829a8cdff9d55f6178989ca8e0406c9.zip |
Fix warnings: tag.c: jumpto_tag(): Np dereference: MI.
Problem : Dereference of null pointer @ 2399.
Diagnostic : Multithreading issue.
Rationale : Error can only occur if global `g_do_tagpreview` changes
while the function is executing.
Resolution : Use local copy of global var.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/tag.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 816e9902fe..724261f08e 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2308,6 +2308,7 @@ jumpto_tag ( win_T *curwin_save = NULL; char_u *full_fname = NULL; int old_KeyTyped = KeyTyped; /* getting the file may reset it */ + const int l_g_do_tagpreview = g_do_tagpreview; pbuf = xmalloc(LSIZE); @@ -2364,7 +2365,7 @@ jumpto_tag ( ++RedrawingDisabled; - if (g_do_tagpreview != 0) { + if (l_g_do_tagpreview != 0) { postponed_split = 0; /* don't split again below */ curwin_save = curwin; /* Save current window */ @@ -2396,7 +2397,7 @@ jumpto_tag ( if (keep_help) { /* A :ta from a help file will keep the b_help flag set. For ":ptag" * we need to use the flag from the window where we came from. */ - if (g_do_tagpreview != 0) + if (l_g_do_tagpreview != 0) keep_help_flag = curwin_save->w_buffer->b_help; else keep_help_flag = curbuf->b_help; @@ -2542,7 +2543,7 @@ jumpto_tag ( foldOpenCursor(); } - 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(); |