cursor: don't leak uncached cursors
authorChristophe Fergeau <cfergeau@redhat.com>
Mon, 4 Jul 2011 15:18:59 +0000 (17:18 +0200)
committerMarc-André Lureau <marcandre.lureau@gmail.com>
Tue, 5 Jul 2011 14:59:16 +0000 (16:59 +0200)
commit8f0d67e40a3a492a406648cca14a822b263ea254
tree0517e7ff528fbb0e428599ed7d1710ed70b1627f
parentdddc9b4d6250b34521716dfd7220d59216d78e2f
cursor: don't leak uncached cursors

When the cursor channel creates a new cursor, if the message
indicates not to cache it, the cursor is leaked after being used.
This commit fixes that, though I'm not really satisfied with it.

==22568== 378,432 bytes in 162 blocks are definitely lost in loss record 7,699 of 7,699
==22568==    at 0x4A0649D: malloc (vg_replace_malloc.c:236)
==22568==    by 0x4E624CF: spice_malloc (mem.c:88)
==22568==    by 0x4E4F1C4: set_cursor (channel-cursor.c:323)
==22568==    by 0x4E4FA29: cursor_handle_set (channel-cursor.c:469)
==22568==    by 0x4E4FD19: spice_cursor_handle_msg (channel-cursor.c:548)
==22568==    by 0x4E30292: spice_channel_recv_msg (spice-channel.c:1641)
==22568==    by 0x4E3062A: spice_channel_iterate_read (spice-channel.c:1776)
==22568==    by 0x4E307F9: spice_channel_iterate (spice-channel.c:1820)
==22568==    by 0x4E30EE4: spice_channel_coroutine (spice-channel.c:1968)
==22568==    by 0x4EE48A2: coroutine_thread (coroutine_gthread.c:77)
==22568==    by 0x302E4683A5: g_thread_create_proxy (gthread.c:1955)
==22568==    by 0x302C807AF0: start_thread (pthread_create.c:305)
gtk/channel-cursor.c