author | Tomas Kuthan <tomas.kuthan@oracle.com> |
Mon, 11 Jun 2012 22:35:26 -0700 | |
changeset 866 | c6e2467e422e |
parent 284 | ca417a821aee |
permissions | -rw-r--r-- |
--- libxml2-2.7.6/xpath.c.orig Mon Jun 6 11:10:14 2011 +++ libxml2-2.7.6/xpath.c Mon Jun 6 11:11:04 2011 @@ -11739,11 +11739,16 @@ if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { xmlXPathObjectPtr tmp; - /* pop the result */ + /* pop the result if any */ tmp = valuePop(ctxt); - xmlXPathReleaseObject(xpctxt, tmp); - /* then pop off contextObj, which will be freed later */ - valuePop(ctxt); + if (tmp != contextObj) { + /* + * Free up the result + * then pop off contextObj, which will be freed later + */ + xmlXPathReleaseObject(xpctxt, tmp); + valuePop(ctxt); + } goto evaluation_error; }