This is an automated email from the ASF dual-hosted git repository. gancho 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 51ba47b Coverity 1363659: Dereference before null check 51ba47b is described below commit 51ba47b122e0e78e39aae7dd06d1ac91bbb9f411 Author: Gancho Tenev <gan...@apache.com> AuthorDate: Thu May 11 12:23:31 2017 -0700 Coverity 1363659: Dereference before null check Problem: CID 1363659 (#1 of 1): Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking sp->server.vconn suggests that it may be null, but it has already been dereferenced on all paths leading to the check. Fix: Removed the check the TSReleaseAssert(sp->server.vconn != nullptr); should make sure we don't dereference nullptr. --- example/passthru/passthru.cc | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/example/passthru/passthru.cc b/example/passthru/passthru.cc index a42ad20..14a0a2c 100644 --- a/example/passthru/passthru.cc +++ b/example/passthru/passthru.cc @@ -198,35 +198,33 @@ PassthruSessionEvent(TSCont cont, TSEvent event, void *edata) sp->server.writeio.write(sp->server.vconn, sp->contp); } - if (sp->server.vconn != nullptr) { - int64_t nbytes; - - nbytes = sp->client.readio.transfer_to(sp->server.writeio); - PassthruSessionDebug(sp, "proxied %" PRId64 " bytes from client vconn=%p to server vconn=%p", nbytes, sp->client.vconn, - sp->server.vconn); - if (nbytes) { - TSVIOReenable(sp->client.readio.vio); - TSVIOReenable(sp->server.writeio.vio); - } - - nbytes = sp->server.readio.transfer_to(sp->client.writeio); - PassthruSessionDebug(sp, "proxied %" PRId64 " bytes from server vconn=%p to client vconn=%p", nbytes, sp->server.vconn, - sp->client.vconn); - if (nbytes) { - TSVIOReenable(sp->server.readio.vio); - TSVIOReenable(sp->client.writeio.vio); - } + int64_t nbytes; + + nbytes = sp->client.readio.transfer_to(sp->server.writeio); + PassthruSessionDebug(sp, "proxied %" PRId64 " bytes from client vconn=%p to server vconn=%p", nbytes, sp->client.vconn, + sp->server.vconn); + if (nbytes) { + TSVIOReenable(sp->client.readio.vio); + TSVIOReenable(sp->server.writeio.vio); } - if (PassthruSessionIsFinished(sp)) { - delete sp; - return TS_EVENT_NONE; + nbytes = sp->server.readio.transfer_to(sp->client.writeio); + PassthruSessionDebug(sp, "proxied %" PRId64 " bytes from server vconn=%p to client vconn=%p", nbytes, sp->server.vconn, + sp->client.vconn); + if (nbytes) { + TSVIOReenable(sp->server.readio.vio); + TSVIOReenable(sp->client.writeio.vio); } + } - TSVIOReenable(arg.vio); + if (PassthruSessionIsFinished(sp)) { + delete sp; return TS_EVENT_NONE; } + TSVIOReenable(arg.vio); + return TS_EVENT_NONE; + if (event == TS_EVENT_VCONN_WRITE_READY) { if (PassthruSessionIsFinished(sp)) { delete sp; -- To stop receiving notification emails like this one, please contact ['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].