From: Aki Tuomi Date: Mon, 18 Sep 2017 09:56:02 +0000 (+0300) Subject: bindbackend: Move throw to correct place in startTransaction X-Git-Tag: rec-4.1.0-rc1~33^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10464f03d4fe8cda142c814130fe1e4e1f1c17c3;p=thirdparty%2Fpdns.git bindbackend: Move throw to correct place in startTransaction The cleanup code wasn't being executed due to premature throw --- diff --git a/modules/bindbackend/bindbackend2.cc b/modules/bindbackend/bindbackend2.cc index 606ac23685..eeeb558c13 100644 --- a/modules/bindbackend/bindbackend2.cc +++ b/modules/bindbackend/bindbackend2.cc @@ -205,10 +205,10 @@ bool Bind2Backend::startTransaction(const DNSName &qname, int id) d_transaction_tmpname=bbd.d_filename+"."+itoa(random()); d_of=new ofstream(d_transaction_tmpname.c_str()); if(!*d_of) { - throw DBException("Unable to open temporary zonefile '"+d_transaction_tmpname+"': "+stringerror()); unlink(d_transaction_tmpname.c_str()); delete d_of; d_of=0; + throw DBException("Unable to open temporary zonefile '"+d_transaction_tmpname+"': "+stringerror()); } *d_of<<"; Written by PowerDNS, don't edit!"<