diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-26 16:54:31 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-28 13:17:36 +0100 |
commit | 33edba587ddc7a2d14514f8676c34e9d31d7363f (patch) | |
tree | e2af37d468e745bbd0f620701f7738d1f37b496e | |
parent | 5fea8c7ebe21721464f7167c9624e4d457158fa8 (diff) | |
download | libxslt-33edba587ddc7a2d14514f8676c34e9d31d7363f.tar.gz |
malloc-fail: Fix memory leak in xsltCopyText
Found with libFuzzer, see #84.
-rw-r--r-- | libxslt/transform.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libxslt/transform.c b/libxslt/transform.c index 1180a38a..d7992605 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -1087,8 +1087,10 @@ xsltCopyText(xsltTransformContextPtr ctxt, xmlNodePtr target, if (xmlDictOwns(ctxt->dict, cur->content)) copy->content = cur->content; else { - if ((copy->content = xmlStrdup(cur->content)) == NULL) + if ((copy->content = xmlStrdup(cur->content)) == NULL) { + xmlFreeNode(copy); return NULL; + } } ctxt->lasttext = NULL; |