From fb0c65a493db69a0516d8566206a621b83e96bed Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Mon, 29 Oct 2007 21:59:26 +0000 Subject: [PATCH] handle mutex creation failure before marking the span configured. git-svn-id: http://svn.openzap.org/svn/openzap/trunk@313 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/openzap/src/zap_io.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/openzap/src/zap_io.c b/libs/openzap/src/zap_io.c index c15ac3c1ab..951f7424d7 100644 --- a/libs/openzap/src/zap_io.c +++ b/libs/openzap/src/zap_io.c @@ -288,10 +288,13 @@ zap_status_t zap_span_create(zap_io_interface_t *zio, zap_span_t **span) if (globals.span_index < ZAP_MAX_SPANS_INTERFACE) { new_span = &globals.spans[++globals.span_index]; memset(new_span, 0, sizeof(*new_span)); + status = zap_mutex_create(&new_span->mutex); + if (status != ZAP_SUCCESS) { + goto done; + } zap_set_flag(new_span, ZAP_SPAN_CONFIGURED); new_span->span_id = globals.span_index; new_span->zio = zio; - zap_mutex_create(&new_span->mutex); zap_copy_string(new_span->tone_map[ZAP_TONEMAP_DIAL], "%(1000,0,350,440)", ZAP_TONEMAP_LEN); zap_copy_string(new_span->tone_map[ZAP_TONEMAP_RING], "%(2000,4000,440,480)", ZAP_TONEMAP_LEN); zap_copy_string(new_span->tone_map[ZAP_TONEMAP_BUSY], "%(500,500,480,620)", ZAP_TONEMAP_LEN); @@ -302,6 +305,8 @@ zap_status_t zap_span_create(zap_io_interface_t *zio, zap_span_t **span) } zap_mutex_unlock(globals.mutex); +done: + return status; }