From a09f39e2c6d76eb02c3a3b3fef77f71896313326 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 17 Nov 2014 12:03:12 -0500 Subject: [PATCH] parse_view_column_config: avoid reading uninitialized/NULL variable If the view does not support a specific type or we cannot find a matching column, we do not want to use "column->type" to report the error. It is either uninitialized or NULL in these error conditions. Instead, we can want to use the type we are looking for. --- src/view.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/view.c b/src/view.c index 96ec5a9..560d41f 100644 --- a/src/view.c +++ b/src/view.c @@ -1264,12 +1264,12 @@ parse_view_column_config(const char *view_name, enum view_column_type type, if (!(view->ops->column_bits & (1 << type))) return error("The %s view does not support %s column", view->name, - view_column_name(column->type)); + view_column_name(type)); column = get_view_column(view, type); if (!column) return error("The %s view does not have a %s column configured", view->name, - view_column_name(column->type)); + view_column_name(type)); if (option_name) return parse_view_column_option(column, option_name, argv[0]); -- 2.11.4.GIT