[Spice-devel] [PATCH 3/3] Initialize usb_redir_hello_header to 0 in usbredirparser_init

Christophe Fergeau cfergeau at redhat.com
Thu Nov 20 09:08:24 PST 2014


This fixes this valgrind warning during virt-viewer startup:

==29279== Uninitialised byte(s) found during client check request
==29279==    at 0x5C85FCD: usbredirparser_queue (usbredirparser.c:1154)
==29279==    by 0x5C83E5F: usbredirparser_init (usbredirparser.c:185)
==29279==    by 0x5A79BA9: usbredirhost_open_full (usbredirhost.c:739)
==29279==    by 0x573E462: spice_usbredir_channel_set_context (channel-usbredir.c:212)
==29279==    by 0x57439CA: channel_new (usb-device-manager.c:738)
==29279==    by 0x3E1980FD34: g_closure_invoke (gclosure.c:768)
==29279==    by 0x3E19821A41: signal_emit_unlocked_R (gsignal.c:3553)
==29279==    by 0x3E1982A180: g_signal_emit_valist (gsignal.c:3309)
==29279==    by 0x3E1982A3AE: g_signal_emit (gsignal.c:3365)
==29279==    by 0x571A1F2: spice_session_channel_new (spice-session.c:1939)
==29279==    by 0x571BAD9: spice_channel_constructed (spice-channel.c:142)
==29279==    by 0x3E198154F3: g_object_new_internal (gobject.c:1814)
==29279==  Address 0x115bc729 is 41 bytes inside a block of size 80 alloc'd
==29279==    at 0x4A06BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==29279==    by 0x5C85E56: usbredirparser_queue (usbredirparser.c:1132)
==29279==    by 0x5C83E5F: usbredirparser_init (usbredirparser.c:185)
==29279==    by 0x5A79BA9: usbredirhost_open_full (usbredirhost.c:739)
==29279==    by 0x573E462: spice_usbredir_channel_set_context (channel-usbredir.c:212)
==29279==    by 0x57439CA: channel_new (usb-device-manager.c:738)
==29279==    by 0x3E1980FD34: g_closure_invoke (gclosure.c:768)
==29279==    by 0x3E19821A41: signal_emit_unlocked_R (gsignal.c:3553)
==29279==    by 0x3E1982A180: g_signal_emit_valist (gsignal.c:3309)
==29279==    by 0x3E1982A3AE: g_signal_emit (gsignal.c:3365)
==29279==    by 0x571A1F2: spice_session_channel_new (spice-session.c:1939)
==29279==    by 0x571BAD9: spice_channel_constructed (spice-channel.c:142)
=
---
 usbredirparser/usbredirparser.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usbredirparser/usbredirparser.c b/usbredirparser/usbredirparser.c
index 2cebada..8076b72 100644
--- a/usbredirparser/usbredirparser.c
+++ b/usbredirparser/usbredirparser.c
@@ -161,7 +161,7 @@ void usbredirparser_init(struct usbredirparser *parser_pub,
 {
     struct usbredirparser_priv *parser =
         (struct usbredirparser_priv *)parser_pub;
-    struct usb_redir_hello_header hello;
+    struct usb_redir_hello_header hello = { { 0 }, };
 
     parser->flags = (flags & ~usbredirparser_fl_no_hello);
     if (parser->callb.alloc_lock_func) {
-- 
2.1.0



More information about the Spice-devel mailing list