unified2: unlock using same dereference as lock

Addresses Coverity CIDs:
    1400797
    1400796

Note that the mutex was actually being unlocked, but
from a different variable pointing to the same mutex.
pull/2606/head
Jason Ish 10 years ago committed by Victor Julien
parent 285b566205
commit ddf1bf6518

@ -952,12 +952,12 @@ static int Unified2IPv6TypeAlert(ThreadVars *t, const Packet *p, void *data)
if (ret != 1) {
SCLogError(SC_ERR_FWRITE, "Error: fwrite failed: %s", strerror(errno));
aun->unified2alert_ctx->file_ctx->alerts += i;
SCMutexUnlock(&aun->unified2alert_ctx->file_ctx->fp_mutex);
SCMutexUnlock(&file_ctx->fp_mutex);
return -1;
}
fflush(aun->unified2alert_ctx->file_ctx->fp);
aun->unified2alert_ctx->file_ctx->alerts++;
SCMutexUnlock(&aun->unified2alert_ctx->file_ctx->fp_mutex);
SCMutexUnlock(&file_ctx->fp_mutex);
}
return 0;
@ -1133,13 +1133,13 @@ static int Unified2IPv4TypeAlert (ThreadVars *tv, const Packet *p, void *data)
ret = Unified2PacketTypeAlert(aun, p, event_id, stream);
if (ret != 1) {
aun->unified2alert_ctx->file_ctx->alerts += i;
SCMutexUnlock(&aun->unified2alert_ctx->file_ctx->fp_mutex);
SCMutexUnlock(&file_ctx->fp_mutex);
return -1;
}
fflush(aun->unified2alert_ctx->file_ctx->fp);
aun->unified2alert_ctx->file_ctx->alerts++;
SCMutexUnlock(&aun->unified2alert_ctx->file_ctx->fp_mutex);
SCMutexUnlock(&file_ctx->fp_mutex);
}
return 0;

Loading…
Cancel
Save