diff options
author | Jamey Sharp <jamey@minilop.net> | 2006-09-09 15:52:37 -0700 |
---|---|---|
committer | Jamey Sharp <jamey@minilop.net> | 2006-09-09 15:52:37 -0700 |
commit | 81d6fd64c09255e90104b3c6e37c9023bd0aa6ec (patch) | |
tree | 225f9863199cb849217bc2caf9191a7d2a30934c /src/xcb_xid.c | |
parent | f6d4fc007fc0f4bdf8f06ab0798aadce87d468d1 (diff) |
Handle XC-MISC request failure when allocating new XIDs. (fixes #7001)
Diffstat (limited to 'src/xcb_xid.c')
-rw-r--r-- | src/xcb_xid.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/xcb_xid.c b/src/xcb_xid.c index 7d7f784..1c53b53 100644 --- a/src/xcb_xid.c +++ b/src/xcb_xid.c @@ -39,11 +39,16 @@ CARD32 XCBGenerateID(XCBConnection *c) pthread_mutex_lock(&c->xid.lock); if(c->xid.last == c->xid.max) { - XCBXCMiscGetXIDRangeRep *range; - range = XCBXCMiscGetXIDRangeReply(c, XCBXCMiscGetXIDRange(c), 0); - c->xid.last = range->start_id; - c->xid.max = range->start_id + (range->count - 1) * c->xid.inc; - free(range); + XCBXCMiscGetXIDRangeRep *range; + range = XCBXCMiscGetXIDRangeReply(c, XCBXCMiscGetXIDRange(c), 0); + if(!range) + { + pthread_mutex_unlock(&c->xid.lock); + return -1; + } + c->xid.last = range->start_id; + c->xid.max = range->start_id + (range->count - 1) * c->xid.inc; + free(range); } ret = c->xid.last | c->xid.base; c->xid.last += c->xid.inc; |