Commit 624f839f authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

made sure data (RRsetList) is initialized in each iteration of the while loop

in runQuery().

the bug is a perfect example of why we should define variables as locally as
possible (and more preferably why we should avoid using variables maintaining
states as much as possible in the first place)


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/parkinglot@715 e5f2f494-b856-4b98-b285-d166d9295462
parent 0e918988
......@@ -13,11 +13,11 @@ namespace dns {
DSResult
DataSrc::runQuery(Query q) {
DSResult result;
RRsetList data, sigs;
Name container(".");
Message& m = q.message();
while (!q.tasks().empty()) {
RRsetList data, sigs;
bool found = false;
QueryTaskPtr task = q.tasks().front();
q.tasks().pop();
......@@ -40,6 +40,7 @@ DataSrc::runQuery(Query q) {
switch (result) {
case SUCCESS:
// XXX: what if 'data' contains more than one RRset?
m.addRRset(task->section, data[0]);
if (q.wantDnssec() && sigs.size() == 1) {
m.addRRset(Section(task->section), sigs[0]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment