From 725fe422904d61a855d5d997f53fc5a29f317e24 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 22 Apr 2009 21:54:51 +0300 Subject: [PATCH] src/view.c: valgrind: hackish fix of uninitialised value usage valgrind log when run viewer ==9981== Conditional jump or move depends on uninitialised value(s) ==9981== at 0x45891B: view_map_offset_and_column (view.c:584) ==9981== by 0x458D5B: view_column_to_offset (view.c:917) ==9981== by 0x458DD8: view_set_first_showed (view.c:1443) ==9981== by 0x45B79F: view_new (view.c:4136) ==9981== by 0x45B911: mc_internal_viewer (view.c:3969) ==9981== by 0x423D85: view_file_at_line (cmd.c:132) ==9981== by 0x423E78: do_view_cmd (cmd.c:217) ==9981== by 0x45CDE7: buttonbar_call (widget.c:2425) ==9981== by 0x45D754: buttonbar_callback (widget.c:2456) ==9981== by 0x427D42: dlg_process_event (dialog.c:618) ==9981== by 0x428035: run_dlg (dialog.c:789) ==9981== by 0x43E708: main (main.c:1688) ==9981== Uninitialised value was created by a stack allocation ==9981== at 0x4586F0: view_map_offset_and_column (view.c:593) Signed-off-by: Sergei Trofimovich --- src/view.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/view.c b/src/view.c index 2d111f254..cc909535d 100644 --- a/src/view.c +++ b/src/view.c @@ -593,6 +593,12 @@ view_map_offset_and_column (WView *view, struct cache_line *line, { const screen_dimen width = view->data_area.width; struct read_info info; + + /* HACK: valgrind screams here. + * TODO: to figure out WHY valgrind detects uninitialized + * variables. Maybe, info isn't fully initialized? + */ + memset (&info, 0, sizeof info); offset_type nroff_start = 0; int nroff_seq = 0; int w;