Commit 8afcda93 authored by Sergei Golubchik's avatar Sergei Golubchik

ASAN/valgrind errors in connect.misc test

accessing freed memory.
Before XMLCOL::WriteColumn() Tdbp->Clist gets assigned
a nodelist in

      Clist = RowNode->SelectNodes(g, Colname, Clist);

which is RowNode->Doc->Xop->nodesetval.

In XMLCOL::WriteColumn()

        ValNode = ColNode->SelectSingleNode(g, Xname, Vxnp);

calls LIBXMLDOC::GetNodeList() again, which frees the previous
XPath object Xop and replaces it with a new one.

In this case RowNode->Doc == ColNode->Doc, so Clist->Listp
points to a freed memory now.
parent 5e5feb84
......@@ -1803,6 +1803,9 @@ void XMLCOL::WriteColumn(PGLOBAL g)
else if (Tdbp->Clist)
ColNode = NULL;
// refresh CList in case its Listp was freed in SelectSingleNode above
if (Tdbp->Clist)
Tdbp->RowNode->SelectNodes(g, Tdbp->Colname, Tdbp->Clist);
} // endfor i
/*********************************************************************/
......
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