Wireshark-dev: [Wireshark-dev] warning in packet-rohc, r40673
From: Martin Kaiser <[email protected]>
Date: Mon, 23 Jan 2012 22:58:13 +0100
Hi Anders and all,

I get a warning (treated as an error)

[email protected]:~/src/wireshark.svn$ svn info
...
Last Changed Author: etxrab
Last Changed Rev: 40673
Last Changed Date: 2012-01-23 22:13:10 +0100 (Mon, 23 Jan 2012)

[email protected]:~/src/wireshark.svn$ uname -a
Linux greta.... 2.6.32-5-amd64 #1 SMP Thu Nov 3 03:41:26 UTC 2011 x86_64 GNU/Linux

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I./../.. -I./.. -I/usr/local/include -I/usr/include -DPLUGIN_DIR=\"/usr/local/lib/wireshark/plugins/1.7.1\" -Werror -DINET6 -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -DGSEAL_ENABLE -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES -D_FORTIFY_SOURCE=2 "-D_U_=__attribute__((unused))" -g -O2 -Wall -W -Wextra -Wdeclaration-after-statement -Wendif-labels -Wpointer-arith -Wno-pointer-sign -Warray-bounds -Wcast-align -Wformat-security -Wold-style-definition -I/usr/local/include -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include -MT libdissectors_la-packet-rohc.lo -MD -MP -MF .deps/libdissectors_la-packet-rohc.Tpo -c packet-rohc.c  -fPIC -DPIC -o .libs/libdissectors_la-packet-rohc.o
cc1: warnings being treated as errors
packet-rohc.c: In function dissect_rohc_ir_rtp_udp_profile_static:
packet-rohc.c:1019: error: protocol may be used uninitialized in this function
make[5]: *** [libdissectors_la-packet-rohc.lo] Error 1


Would sth simple like this be ok as a fix?

Best regards,

   Martin

Index: epan/dissectors/packet-rohc.c
===================================================================
--- epan/dissectors/packet-rohc.c   (revision 40673)
+++ epan/dissectors/packet-rohc.c   (working copy)
@@ -1016,7 +1016,7 @@
 
     proto_item *item, *ipv4_item, *udp_item, *rtp_item;
     proto_tree *sub_tree=NULL, *static_ipv4_tree, *static_udp_tree, *static_rtp_tree;
-    guint8 version, protocol;
+    guint8 version, protocol = IP_PROTO_IP;
     int start_offset, tree_start_offset;
 
     start_offset = offset;