[Spice-commits] 2 commits - src/spice-gtk-session.c

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Mon Feb 27 10:45:58 UTC 2017


 src/spice-gtk-session.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit bd9fda26a771749264d222cbfeaa3524c207b43c
Author: Victor Toso <me at victortoso.com>
Date:   Tue Feb 21 11:18:26 2017 +0100

    gtk-session: initialize array without memset
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 129d628..cfdfc4c 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -615,7 +615,7 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
     }
 
     SpiceGtkSessionPrivate *s = self->priv;
-    guint32 types[SPICE_N_ELEMENTS(atom2agent)];
+    guint32 types[SPICE_N_ELEMENTS(atom2agent)] = { 0 };
     char *name;
     int a, m, t;
     int selection;
@@ -635,7 +635,6 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
         }
     }
 
-    memset(types, 0, sizeof(types));
     for (a = 0; a < n_atoms; a++) {
         name = gdk_atom_name(atoms[a]);
         for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) {
commit 98569163ca545895adbaa6b3792860d8d1e0b6b0
Author: Victor Toso <me at victortoso.com>
Date:   Tue Feb 21 11:33:47 2017 +0100

    gtk-session: check if retrieving clipboard data failed
    
    In case of failure, the GdkAtom *atoms will be set to NULL.
    Including this check to an early return.
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index fbb7c82..129d628 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -609,6 +609,11 @@ static void clipboard_get_targets(GtkClipboard *clipboard,
 
     g_return_if_fail(SPICE_IS_GTK_SESSION(self));
 
+    if (atoms == NULL) {
+        SPICE_DEBUG("Retrieving the clipboard data has failed");
+        return;
+    }
+
     SpiceGtkSessionPrivate *s = self->priv;
     guint32 types[SPICE_N_ELEMENTS(atom2agent)];
     char *name;


More information about the Spice-commits mailing list