This is an automated email from the ASF dual-hosted git repository.
bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 0303be8ea8 Assigning variables in asserts in the example intercept
plugin (#10516)
0303be8ea8 is described below
commit 0303be8ea8157dc3fbb8d86156ff6fcdfd2f9626
Author: Bryan Call <[email protected]>
AuthorDate: Mon Sep 25 11:47:20 2023 -0700
Assigning variables in asserts in the example intercept plugin (#10516)
Coverity 1518611: Side effect in assertion
Coverity 1518597: Side effect in assertion
Coverity 1518596: Side effect in assertion
Coverity 1518595: Side effect in assertion
Coverity 1518570: Side effect in assertion
---
example/plugins/c-api/intercept/intercept.cc | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/example/plugins/c-api/intercept/intercept.cc
b/example/plugins/c-api/intercept/intercept.cc
index c1bc1f93e9..e6b8aa98f2 100644
--- a/example/plugins/c-api/intercept/intercept.cc
+++ b/example/plugins/c-api/intercept/intercept.cc
@@ -91,8 +91,11 @@ struct InterceptIOChannel {
read(TSVConn vc, TSCont contp)
{
TSReleaseAssert(this->vio == nullptr);
- TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
- TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
+
+ this->iobuf = TSIOBufferCreate();
+ TSReleaseAssert(this->iobuf);
+ this->reader = TSIOBufferReaderAlloc(this->iobuf);
+ TSReleaseAssert(this->reader);
this->vio = TSVConnRead(vc, contp, this->iobuf, INT64_MAX);
}
@@ -101,8 +104,10 @@ struct InterceptIOChannel {
write(TSVConn vc, TSCont contp)
{
TSReleaseAssert(this->vio == nullptr);
- TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
- TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
+ this->iobuf = TSIOBufferCreate();
+ TSReleaseAssert(this->iobuf);
+ this->reader = TSIOBufferReaderAlloc(this->iobuf);
+ TSReleaseAssert(this->reader);
this->vio = TSVConnWrite(vc, contp, this->reader, INT64_MAX);
}
@@ -205,9 +210,9 @@ union argument_type {
static TSCont
InterceptContCreate(TSEventFunc hook, TSMutex mutexp, void *data)
{
- TSCont contp;
+ TSCont contp = TSContCreate(hook, mutexp);
+ TSReleaseAssert(contp);
- TSReleaseAssert((contp = TSContCreate(hook, mutexp)));
TSContDataSet(contp, data);
return contp;
}