diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-26 16:53:30 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-26 16:55:37 +0100 |
commit | d1e392fe2e4afded8e65a58fad1a6ef756b59001 (patch) | |
tree | 7f2030aea6e17c95fd2714337aa73644bb45ef6d /libxslt | |
parent | b47ccc867e4e39dad5db7ab6c61ca0e0f1c35fee (diff) | |
download | libxslt-d1e392fe2e4afded8e65a58fad1a6ef756b59001.tar.gz |
malloc-fail: Fix memory leak in xsltInitCtxtKey
Found with libFuzzer, see #84.
Diffstat (limited to 'libxslt')
-rw-r--r-- | libxslt/keys.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libxslt/keys.c b/libxslt/keys.c index 34f7b51e..f23cc4e9 100644 --- a/libxslt/keys.c +++ b/libxslt/keys.c @@ -829,7 +829,10 @@ fprintf(stderr, "xsltInitCtxtKey %s : %d\n", keyDef->name, ctxt->keyInitLevel); keylist = xmlXPathNodeSetCreate(cur); if (keylist == NULL) goto error; - xmlHashAddEntry(table->keys, str, keylist); + if (xmlHashAddEntry(table->keys, str, keylist) < 0) { + xmlXPathFreeNodeSet(keylist); + goto error; + } } else { /* * TODO: How do we know if this function failed? |