[spice-gtk] win-usb: Initialize GError before using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



GError variables must be set to NULL before passing them to a function
which might set them.
This fixes the runtime warning reported in rhbz#1138195:

(remote-viewer.exe:3896): GLib-WARNING **: GError set over the top of a
previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL
before it's set.
The overwriting error message was: handle_dev_change: Error getting
device list from libusb: Other error [-99]
---
 gtk/win-usb-dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gtk/win-usb-dev.c b/gtk/win-usb-dev.c
index 7e82fb9..14ab7af 100644
--- a/gtk/win-usb-dev.c
+++ b/gtk/win-usb-dev.c
@@ -344,7 +344,7 @@ static void handle_dev_change(GUdevClient *self)
     GUdevDevice *changed_dev = NULL;
     ssize_t dev_count;
     int is_dev_change;
-    GError *err;
+    GError *err = NULL;
     GList *now_devs = NULL;
     GList *llist, *slist; /* long-list and short-list*/
     GList *lit, *sit; /* iterators for long-list and short-list */
-- 
1.9.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]