Skip to content

Commit 30c58ab

Browse files
committed
Fix potential memory leak in XPath evaluation results
1 parent db1f7b1 commit 30c58ab

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ PHP NEWS
88

99
- DOM:
1010
. Add some missing ZPP checks. (nielsdos)
11+
. Fix potential memory leak in XPath evaluation results. (nielsdos)
1112

1213
- Gettext:
1314
. Fixed sigabrt raised with dcgettext/dcngettext calls with gettext 0.22.5

ext/dom/xpath.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,11 @@ static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs,
125125
}
126126
}
127127
break;
128-
default:
129-
ZVAL_STRING(&fci.params[i], (char *)xmlXPathCastToString(obj));
128+
default: {
129+
str = (char *)xmlXPathCastToString(obj);
130+
ZVAL_STRING(&fci.params[i], str);
131+
xmlFree(str);
132+
}
130133
}
131134
xmlXPathFreeObject(obj);
132135
}

0 commit comments

Comments
 (0)