From 3465a945e187bde08c34188eee2dc08ecae778dd Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Tue, 31 Mar 2015 10:54:37 +0200 Subject: Fix warnings: terminal.c: redraw(): Np dereference: RI. Problem : Dereference of null pointer @ 1053. Diagnostic : Real issue. Rationale : Branch "Exiting focused terminal" can actually be executed when term is NULL. Resolution : Guard branch with term check. --- src/nvim/terminal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/terminal.c') diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index daba7b943f..b3cdfe8775 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1047,7 +1047,7 @@ static void redraw(bool restore_cursor) setcursor(); } else if (restore_cursor) { ui_cursor_goto(save_row, save_col); - } else { + } else if (term) { // exiting terminal focus, put the window cursor in a valid position int height, width; vterm_get_size(term->vt, &height, &width); -- cgit From 1b4dbdf45bfc59b84da48bbbac7209fda61c5d22 Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Tue, 31 Mar 2015 11:08:31 +0200 Subject: Fix warnings: terminal.c: get_config_string(): Dead init: RI. Problem : Dead initialization @ 1109. Diagnostic : Real issue. Rationale : `obj` is immediately assigned another value through GET_CONFIG_VALUE macro. Resolution : Don't initialize. Helped-by: oni-link --- src/nvim/terminal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/terminal.c') diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index b3cdfe8775..f9786614f1 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1099,18 +1099,19 @@ static bool is_focused(Terminal *term) do { \ Error err; \ o = dict_get_value(t->buf->b_vars, cstr_as_string(k), &err); \ - if (obj.type == kObjectTypeNil) { \ + if (o.type == kObjectTypeNil) { \ o = dict_get_value(&globvardict, cstr_as_string(k), &err); \ } \ } while (0) static char *get_config_string(Terminal *term, char *key) { - Object obj = OBJECT_INIT; + Object obj; GET_CONFIG_VALUE(term, key, obj); if (obj.type == kObjectTypeString) { return obj.data.string.data; } + api_free_object(obj); return NULL; } -- cgit From af8adc2d8c0af9906aaa719cf3e1a8b2b34ecb4a Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Tue, 31 Mar 2015 11:12:01 +0200 Subject: Fix warnings: terminal.c: get_config_int(): Dead init: RI. Problem : Dead initialization @ 1119. Diagnostic : Real issue. Rationale : `obj` is immediately assigned another value through GET_CONFIG_VALUE macro. Resolution : Don't initialize. Helped-by: oni-link --- src/nvim/terminal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/terminal.c') diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index f9786614f1..dda5cf69ab 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -1117,11 +1117,12 @@ static char *get_config_string(Terminal *term, char *key) static int get_config_int(Terminal *term, char *key) { - Object obj = OBJECT_INIT; + Object obj; GET_CONFIG_VALUE(term, key, obj); if (obj.type == kObjectTypeInteger) { return (int)obj.data.integer; } + api_free_object(obj); return 0; } -- cgit