Skip to content

Commit 1fbef62

Browse files
author
Melvyn Sopacua
committed
(xslt: error_print) Fixes a leak when multiple error messages are issued
during a transformation. # It's probably better to wrap this in an internal function, since it's # easily forgotten.
1 parent cdc3b6d commit 1fbef62

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/xslt/sablot.c

+4
Original file line numberDiff line numberDiff line change
@@ -1633,6 +1633,10 @@ static MH_ERROR error_print(void *user_data, SablotHandle proc, MH_ERROR code, M
16331633
msgbuf = emalloc((sizeof(msgformat) - 4) + strlen(errmsg) + strlen(errline) + 1);
16341634
sprintf(msgbuf, msgformat, errline, errmsg);
16351635

1636+
/* If an old message exists, remove it -> leak */
1637+
if (XSLT_ERRSTR(handle))
1638+
efree(XSLT_ERRSTR(handle));
1639+
16361640
/* Copy the error message onto the handle for use when
16371641
the xslt_error function is called */
16381642
XSLT_ERRSTR(handle) = estrdup(errmsg);

0 commit comments

Comments
 (0)