Xext: Recover from miSyncInitFenceFromFD failure without crashing
authorKeith Packard <keithp@keithp.com>
Tue, 19 Nov 2013 06:33:27 +0000 (22:33 -0800)
committerKeith Packard <keithp@keithp.com>
Sun, 24 Nov 2013 06:06:19 +0000 (22:06 -0800)
miSyncDestroyFence must not be called unless miSyncInitFence has been
invoked, so if miSyncInitFenceFromFD fails, we must free the fence
manually.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Fredrik Höglund <fredrik@kde.org>
Xext/sync.c

index dd18cde..2d58ea1 100644 (file)
@@ -929,7 +929,7 @@ SyncCreateFenceFromFD(ClientPtr client, DrawablePtr pDraw, XID id, int fd, BOOL
 
     status = miSyncInitFenceFromFD(pDraw, pFence, fd, initially_triggered);
     if (status != Success) {
-        miSyncDestroyFence(pFence);
+        dixFreeObjectWithPrivates(pFence, PRIVATE_SYNC_FENCE);
         return status;
     }