diff mbox series

[1/3] libtraceevent: Fix uninitialized has_0x compiler warning

Message ID 20220930111002.6107-2-mpetlan@redhat.com (mailing list archive)
State Accepted
Commit 90f5ad217eaa0744b89dd245591880bffeacaf64
Headers show
Series Fix several Coverity andf Clang warnings in libtraceevent | expand

Commit Message

Michael Petlan Sept. 30, 2022, 11:10 a.m. UTC
Initialize has_0x in order to supress the following compiler warning:

  event-parse.c:5654:20: warning: 'has_0x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   5654 |                 if (has_0x)
        |                    ^
  event-parse.c:5619:14: note: 'has_0x' was declared here
   5619 |         bool has_0x;
        |              ^~~~~~

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/event-parse.c b/src/event-parse.c
index 980e980..edf990a 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -5657,7 +5657,7 @@  static inline void print_field(struct trace_seq *s, void *data, int size,
 	struct tep_print_parse *start_parse;
 	struct tep_print_parse *parse;
 	struct tep_print_arg *arg;
-	bool has_0x;
+	bool has_0x = false;
 
 	parse = parse_ptr ? *parse_ptr : event->print_fmt.print_cache;