Skip to content

Commit 0f79c22

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix potential memory leak in XPath evaluation results
2 parents c24f621 + 30c58ab commit 0f79c22

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ PHP NEWS
1010

1111
- DOM:
1212
. Add some missing ZPP checks. (nielsdos)
13+
. Fix potential memory leak in XPath evaluation results. (nielsdos)
1314

1415
- FPM:
1516
. Fixed GH-11086 (FPM: config test runs twice in daemonised mode).

ext/dom/xpath.c

Lines changed: 5 additions & 2 deletions
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)