Avoid leaking memory on invalid cursor commands

When a RedCursorCmd is passed to cursor_channel_process_cmd(), it
constructs a new CursorItem which takes ownership of that command. If
the cursor_cmd->type falls through to the default case of the switch
statement, we will print a warning and return without freeing the
CursorItem (and thus the RedCursorCmd).

Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Jonathon Jongsma 2017-08-22 15:44:58 -05:00 committed by Frediano Ziglio
parent e3bff1eea4
commit 7498675c1d

View File

@ -335,6 +335,7 @@ void cursor_channel_process_cmd(CursorChannel *cursor, RedCursorCmd *cursor_cmd)
break;
default:
spice_warning("invalid cursor command %u", cursor_cmd->type);
cursor_item_unref(cursor_item);
return;
}