From: Remi Gacogne Date: Mon, 14 Mar 2016 10:38:34 +0000 (+0100) Subject: Small fixes reported by coverity X-Git-Tag: dnsdist-1.0.0-beta1~91^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F3565%2Fhead;p=thirdparty%2Fpdns.git Small fixes reported by coverity --- diff --git a/pdns/delaypipe.cc b/pdns/delaypipe.cc index 333a08ea5e..dda8d074fe 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 91df95aab3..afaeef9fab 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 5aaf2d0b0c..ebbd14724f 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 fd6e453ed0..47a8c7ca8b 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 b11ce73c8a..11f3b1fff5 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));