1604. [bug] A xfrout_ctx_create() failure would result in

xfrout_ctx_destroy() being called with a
                        partially initialized structure.
This commit is contained in:
Mark Andrews
2004-04-06 00:31:24 +00:00
parent bc94d297e5
commit aa887cfa4c
2 changed files with 21 additions and 7 deletions
+4
View File
@@ -1,3 +1,7 @@
1604. [bug] A xfrout_ctx_create() failure would result in
xfrout_ctx_destroy() being called with a
partially initialized structure.
1600. [placeholder] rt10861.
1599. [placeholder] rt10861.
+17 -7
View File
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: xfrout.c,v 1.115 2004/03/05 04:57:49 marka Exp $ */
/* $Id: xfrout.c,v 1.115.18.1 2004/04/06 00:31:24 marka Exp $ */
#include <config.h>
@@ -1142,8 +1142,6 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
&xfr));
xfr->mnemonic = mnemonic;
stream = NULL;
db = NULL;
ver = NULL;
quota = NULL;
CHECK(xfr->stream->methods->first(xfr->stream));
@@ -1225,10 +1223,10 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, unsigned int id,
xfr->qname = qname;
xfr->qtype = qtype;
xfr->qclass = qclass;
xfr->db = db;
xfr->ver = ver;
xfr->quota = quota;
xfr->stream = stream;
xfr->db = NULL;
xfr->ver = NULL;
dns_db_attach(db, &xfr->db);
dns_db_attachversion(db, ver, &xfr->ver);
xfr->end_of_stream = ISC_FALSE;
xfr->tsigkey = tsigkey;
xfr->lasttsig = lasttsig;
@@ -1239,6 +1237,12 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, unsigned int id,
xfr->sends = 0;
xfr->shuttingdown = ISC_FALSE;
xfr->mnemonic = NULL;
xfr->buf.base = NULL;
xfr->buf.length = 0;
xfr->txmem = NULL;
xfr->txmemlen = 0;
xfr->stream = NULL;
xfr->quota = NULL;
/*
* Allocate a temporary buffer for the uncompressed response
@@ -1283,6 +1287,12 @@ xfrout_ctx_create(isc_mem_t *mctx, ns_client_t *client, unsigned int id,
*/
xfr->client->shutdown = xfrout_client_shutdown;
xfr->client->shutdown_arg = xfr;
/*
* These MUST be after the last "goto failure;" / CHECK to
* prevent a double free by the caller.
*/
xfr->quota = quota;
xfr->stream = stream;
*xfrp = xfr;
return (ISC_R_SUCCESS);