From a82f68f04e657def7d8a26d4b0ec5aca7f4aa6b3 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 14 Mar 2016 11:38:34 +0100 Subject: [PATCH] Small fixes reported by coverity --- pdns/delaypipe.cc | 4 +++- pdns/dnsrecords.hh | 3 --- pdns/nsecrecords.cc | 6 +++--- pdns/pdns_recursor.cc | 2 +- pdns/syncres.cc | 3 +++ 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pdns/delaypipe.cc b/pdns/delaypipe.cc index 333a08ea5..dda8d074f 100644 --- a/pdns/delaypipe.cc +++ b/pdns/delaypipe.cc @@ -30,8 +30,10 @@ template void ObjectPipe::write(T& t) { auto ptr = new T(t); - if(::write(d_fds[1], &ptr, sizeof(ptr)) != sizeof(ptr)) + if(::write(d_fds[1], &ptr, sizeof(ptr)) != sizeof(ptr)) { + delete ptr; unixDie("write"); + } } template diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 91df95aab..afaeef9fa 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -498,8 +498,6 @@ public: string d_salt; string d_nexthash; std::set d_set; - uint8_t d_saltlength; - uint8_t d_nexthashlength; uint16_t getType() const override { @@ -533,7 +531,6 @@ public: uint8_t d_algorithm, d_flags; uint16_t d_iterations; string d_salt; - uint8_t d_saltlength; }; diff --git a/pdns/nsecrecords.cc b/pdns/nsecrecords.cc index 5aaf2d0b0..ebbd14724 100644 --- a/pdns/nsecrecords.cc +++ b/pdns/nsecrecords.cc @@ -282,9 +282,9 @@ NSEC3PARAMRecordContent::DNSRecordContent* NSEC3PARAMRecordContent::make(const D pr.xfr8BitInt(ret->d_algorithm); pr.xfr8BitInt(ret->d_flags); pr.xfr16BitInt(ret->d_iterations); - pr.xfr8BitInt(ret->d_saltlength); - pr.xfrHexBlob(ret->d_salt); - + uint8_t len; + pr.xfr8BitInt(len); + pr.xfrHexBlob(ret->d_salt, len); return ret; } diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index fd6e453ed..47a8c7ca8 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -188,7 +188,7 @@ struct DNSComboWriter { ComboAddress d_remote, d_local; bool d_tcp; int d_socket; - int d_tag; + int d_tag{0}; string d_query; shared_ptr d_tcpConnection; vector > d_ednsOpts; diff --git a/pdns/syncres.cc b/pdns/syncres.cc index b11ce73c8..11f3b1fff 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -283,6 +283,9 @@ bool SyncRes::doOOBResolve(const DNSName &qname, const QType &qtype, vectorednsstatus) { fprintf(fp, "%s\t%d\t%s", eds.first.toString().c_str(), (int)eds.second.mode, ctime(&eds.second.modeSetAt)); -- 2.40.0