[Spice-devel] [spice-gtk 5/5] Use local GError in spice_convert_newlines()

Christophe Fergeau cfergeau at redhat.com
Mon Jan 6 03:25:13 PST 2014


spice_convert_newlines() declares a local 'err' GError but never uses it as
the function directly uses the 'error' variable passed as an argument.
Use 'err' throughout the function instead of the 'error' argument as this
looks like what was intended.
This fixes this coverity warning:

Error: DEADCODE (CWE-561): [#def144]
spice-gtk-0.22.9-fb3d/spice-gtk3-0.22.9/gtk/spice-util.c:318: assignment: Assigning: "err" = "NULL".
spice-gtk-0.22.9-fb3d/spice-gtk3-0.22.9/gtk/spice-util.c:364: null: At condition "err", the value of "err" must be NULL.
spice-gtk-0.22.9-fb3d/spice-gtk3-0.22.9/gtk/spice-util.c:364: dead_error_condition: The condition "err" cannot be true.
spice-gtk-0.22.9-fb3d/spice-gtk3-0.22.9/gtk/spice-util.c:365: dead_error_begin: Execution cannot reach this statement "g_propagate_error(error, err);".
---
 gtk/spice-util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gtk/spice-util.c b/gtk/spice-util.c
index 1f35629..9aef7c2 100644
--- a/gtk/spice-util.c
+++ b/gtk/spice-util.c
@@ -345,7 +345,7 @@ static gchar* spice_convert_newlines(const gchar *str, gssize len,
     output = g_string_sized_new(len * 2 + 1);
 
     for (i = 0; i < len; i += length + nl) {
-        length = get_line(str + i, len - i, from, &nl, error);
+        length = get_line(str + i, len - i, from, &nl, err);
         if (length < 0)
             break;
 
-- 
1.8.4.2



More information about the Spice-devel mailing list