You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/10/04 15:45:49 UTC
[trafficserver] branch master updated: Fix coverity warnings in
passthru.cc.
This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new ef70f3f Fix coverity warnings in passthru.cc.
ef70f3f is described below
commit ef70f3fd415b439693e1f396633d135b30348d5a
Author: James Peach <jp...@apache.org>
AuthorDate: Tue Oct 4 08:45:36 2016 -0700
Fix coverity warnings in passthru.cc.
---
example/passthru/passthru.cc | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/example/passthru/passthru.cc b/example/passthru/passthru.cc
index 3a693dc..0eae7be 100644
--- a/example/passthru/passthru.cc
+++ b/example/passthru/passthru.cc
@@ -81,10 +81,9 @@ struct PassthruIO {
{
TSReleaseAssert(this->vio == NULL);
- TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
- TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
-
- this->vio = TSVConnRead(vconn, contp, this->iobuf, INT64_MAX);
+ this->iobuf = TSIOBufferCreate();
+ this->reader = TSIOBufferReaderAlloc(this->iobuf);
+ this->vio = TSVConnRead(vconn, contp, this->iobuf, INT64_MAX);
}
// Start a write operation.
@@ -93,10 +92,9 @@ struct PassthruIO {
{
TSReleaseAssert(this->vio == NULL);
- TSReleaseAssert((this->iobuf = TSIOBufferCreate()));
- TSReleaseAssert((this->reader = TSIOBufferReaderAlloc(this->iobuf)));
-
- this->vio = TSVConnWrite(vconn, contp, this->reader, INT64_MAX);
+ this->iobuf = TSIOBufferCreate();
+ this->reader = TSIOBufferReaderAlloc(this->iobuf);
+ this->vio = TSVConnWrite(vconn, contp, this->reader, INT64_MAX);
}
// Transfer data from this IO object to the target IO object.
@@ -206,6 +204,8 @@ PassthruSessionEvent(TSCont cont, TSEvent event, void *edata)
if (sp->server.vconn == nullptr) {
sp->server.vconn = TSHttpConnectWithPluginId(TSNetVConnRemoteAddrGet(sp->client.vconn), PLUGIN_NAME, 0);
+ TSReleaseAssert(sp->server.vconn != nullptr);
+
// Start the server end of the IO before we write any data.
sp->server.readio.read(sp->server.vconn, sp->contp);
sp->server.writeio.write(sp->server.vconn, sp->contp);
@@ -324,7 +324,7 @@ PassthruListen()
TSDebug(PLUGIN_NAME, "listening on port '%s'", ports);
TSfree(ports);
- TSReleaseAssert(cont = TSContCreate(PassthruAccept, nullptr));
+ cont = TSContCreate(PassthruAccept, nullptr);
return TSPortDescriptorAccept(descriptor, cont);
}
@@ -339,14 +339,18 @@ TSPluginInit(int /* argc */, const char * /* argv */ [])
};
// clang-format on
+ TSReturnCode status;
+
TSMgmtStringCreate(TS_RECORDTYPE_CONFIG, "config.plugin.passthru.server_ports", const_cast<char *>(""),
TS_RECORDUPDATE_RESTART_TS, TS_RECORDCHECK_NULL, nullptr /* check_regex */, TS_RECORDACCESS_NULL);
// Start listening on the configured port.
- TSReleaseAssert(PassthruListen() == TS_SUCCESS);
+ status = PassthruListen();
+ TSReleaseAssert(status == TS_SUCCESS);
// Now that succeded, we can register.
- TSReleaseAssert(TSPluginRegister(&info) == TS_SUCCESS);
+ status = TSPluginRegister(&info);
+ TSReleaseAssert(status == TS_SUCCESS);
}
// vim: set sw=2 ts=2 sts=2 et:
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].