diff mbox series

[15/15] libtracefs: initialize val in build_filter()

Message ID 20240606153830.2666120-16-jmarchan@redhat.com (mailing list archive)
State Accepted
Commit e6737d4ee9de9af86061de58cbb3fcb14fd0ffbc
Headers show
Series libtracefs: fix misc issues found by static analysis | expand

Commit Message

Jerome Marchand June 6, 2024, 3:38 p.m. UTC
In build_filter(), val is only initialized if filter->rval->type is
either EXPR_NUMBER or EXPR_STRING. AS far as I can understand that is
expected at that point. Howvever, it doesn't cost much to initialize
it in case the parser let some bogus request pass by and it should
prevent the static analyser to complain.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
 src/tracefs-sqlhist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index 0f678c1..08bd0fa 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -1109,7 +1109,7 @@  static int build_filter(struct tep_handle *tep, struct sqlhist_bison *sb,
 			     const char *val);
 	struct filter *filter = &expr->filter;
 	enum tracefs_compare cmp;
-	const char *val;
+	const char *val = NULL;
 	int and_or = TRACEFS_FILTER_AND;
 	char num[64];
 	int ret;