From: Jason Ish Date: Fri, 17 Feb 2017 17:22:23 +0000 (-0600) Subject: unified2: unlock using same dereference as lock X-Git-Tag: suricata-4.0.0-beta1~276 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ddf1bf6518fd2a87a143652944b129f1075766b9;p=thirdparty%2Fsuricata.git 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. --- diff --git a/src/alert-unified2-alert.c b/src/alert-unified2-alert.c index 1a6f5f567b..ca6da8adfc 100644 --- a/src/alert-unified2-alert.c +++ b/src/alert-unified2-alert.c @@ -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;