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
This commit is contained in:
Michael Jerris 2007-10-29 21:59:26 +00:00
parent 6583971b31
commit fb0c65a493
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}