lmsig_ksils12: fixing coverity issue 185331

This commit is contained in:
Allan Park 2017-12-14 11:30:14 +02:00
parent 86ad82c66d
commit 5b720b3c8e

View File

@ -1508,21 +1508,24 @@ void *signer_thread(void *arg) {
if (ProtectedQueue_count(ctx->signer_queue) == 0)
continue;
if(as != NULL) {
/* in case of asynchronous service check for pending/unsent requests */
ret = process_requests_async(ctx, ksi_ctx, as, ksiFile);
if(!ret) {
// probably fatal error, disable signing, error should be already reported
ctx->disabled = true;
goto cleanup;
/* process signing requests only if there is an open signature file */
if(ksiFile != NULL) {
if(as != NULL) {
/* in case of asynchronous service check for pending/unsent requests */
ret = process_requests_async(ctx, ksi_ctx, as, ksiFile);
if(!ret) {
// probably fatal error, disable signing, error should be already reported
ctx->disabled = true;
goto cleanup;
}
}
}
else {
/* drain all consecutive signature requests from the queue and add
* the last one to aggregation request */
if (ProtectedQueue_peekFront(ctx->signer_queue, (void**) &item)
&& item->type == QITEM_SIGNATURE_REQUEST) {
process_requests(ctx, ksi_ctx, ksiFile);
else {
/* drain all consecutive signature requests from the queue and add
* the last one to aggregation request */
if (ProtectedQueue_peekFront(ctx->signer_queue, (void**) &item)
&& item->type == QITEM_SIGNATURE_REQUEST) {
process_requests(ctx, ksi_ctx, ksiFile);
}
}
}