libxml2-4-xpath-freeing.patch 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. From df83c17e5a2646bd923f75e5e507bc80d73c9722 Mon Sep 17 00:00:00 2001
  2. From: Daniel Veillard <veillard@redhat.com>
  3. Date: Wed, 17 Nov 2010 13:12:14 +0000
  4. Subject: Fix a potential freeing error in XPath
  5. ---
  6. diff --git a/xpath.c b/xpath.c
  7. index 81e33f6..1447be5 100644
  8. --- a/xpath.c
  9. +++ b/xpath.c
  10. @@ -11763,11 +11763,15 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
  11. if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
  12. xmlXPathObjectPtr tmp;
  13. - /* pop the result */
  14. + /* pop the result if any */
  15. tmp = valuePop(ctxt);
  16. - xmlXPathReleaseObject(xpctxt, tmp);
  17. - /* then pop off contextObj, which will be freed later */
  18. - valuePop(ctxt);
  19. + if (tmp != contextObj)
  20. + /*
  21. + * Free up the result
  22. + * then pop off contextObj, which will be freed later
  23. + */
  24. + xmlXPathReleaseObject(xpctxt, tmp);
  25. + valuePop(ctxt);
  26. goto evaluation_error;
  27. }
  28. --
  29. cgit v0.8.3.1