x11 tfp: Plug a leak

Destroy the dummy XImage we create even on success.

http://bugzilla.openedhand.com/show_bug.cgi?id=1918

Based on a patch by: Carlos Martín Nieto <carlos@cmartin.tk>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Emmanuele Bassi 2010-01-05 14:10:19 +00:00
parent fa298b45b5
commit 64c1294cc2

View File

@ -217,8 +217,7 @@ try_alloc_shm (ClutterX11TexturePixmap *texture)
if (priv->shminfo.shmid == -1) if (priv->shminfo.shmid == -1)
goto failed_shmget; goto failed_shmget;
priv->shminfo.shmaddr = priv->shminfo.shmaddr = shmat (priv->shminfo.shmid, 0, 0);
shmat (priv->shminfo.shmid, 0, 0);
if (priv->shminfo.shmaddr == (void *) -1) if (priv->shminfo.shmaddr == (void *) -1)
goto failed_shmat; goto failed_shmat;
@ -230,20 +229,25 @@ try_alloc_shm (ClutterX11TexturePixmap *texture)
if (clutter_x11_untrap_x_errors ()) if (clutter_x11_untrap_x_errors ())
g_warning ("X Error: Failed to setup XShm"); g_warning ("X Error: Failed to setup XShm");
XDestroyImage (dummy_image);
priv->have_shm = TRUE; priv->have_shm = TRUE;
return TRUE; return TRUE;
failed_xshmattach: failed_xshmattach:
g_warning ("XShmAttach failed"); g_warning ("XShmAttach failed");
shmdt (priv->shminfo.shmaddr); shmdt (priv->shminfo.shmaddr);
failed_shmat: failed_shmat:
g_warning ("shmat failed"); g_warning ("shmat failed");
shmctl (priv->shminfo.shmid, IPC_RMID, 0); shmctl (priv->shminfo.shmid, IPC_RMID, 0);
failed_shmget: failed_shmget:
g_warning ("shmget failed"); g_warning ("shmget failed");
XDestroyImage (dummy_image); XDestroyImage (dummy_image);
failed_image_create:
failed_image_create:
if (clutter_x11_untrap_x_errors ()) if (clutter_x11_untrap_x_errors ())
g_warning ("X Error: Failed to setup XShm"); g_warning ("X Error: Failed to setup XShm");