[Spice-devel] [PATCH 2/3] Fix "REVERSE_INULL" caught by coverity
Marc-André Lureau
mlureau at redhat.com
Mon Jul 14 03:17:26 PDT 2014
Hi
----- Original Message -----
> ---
> gtk/channel-cursor.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
> index fb19536..8d75e95 100644
> --- a/gtk/channel-cursor.c
> +++ b/gtk/channel-cursor.c
> @@ -324,6 +324,9 @@ static display_cursor *set_cursor(SpiceChannel *channel,
> SpiceCursor *scursor)
>
> size = 4u * hdr->width * hdr->height;
> cursor = spice_malloc(sizeof(*cursor) + size);
> + if (cursor == NULL)
> + return NULL;
> +
We don't handle OOM conditions in spice-gtk.
> cursor->hdr = *hdr;
> cursor->default_cursor = FALSE;
> cursor->refcount = 1;
> @@ -389,7 +392,7 @@ static display_cursor *set_cursor(SpiceChannel *channel,
> SpiceCursor *scursor)
> }
>
> cache_add:
> - if (cursor && (scursor->flags & SPICE_CURSOR_FLAGS_CACHE_ME)) {
> + if (scursor->flags & SPICE_CURSOR_FLAGS_CACHE_ME) {
ack for this change (this line of code is from first commit :)
> cache_add(c->cursors, hdr->unique, display_cursor_ref(cursor));
> }
>
> --
> 1.9.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list