Skip to content

Commit

Permalink
parser: Fix potential memory leak in xmlParseAttValueInternal
Browse files Browse the repository at this point in the history
Fix memory leak in case xmlParseAttValueInternal is called with a NULL
`len` a non-NULL `alloc` argument. This static function is never called
with such arguments internally, but the misleading code should be fixed
nevertheless.

Fixes #422.
  • Loading branch information
nwellnhof committed Oct 11, 2022
1 parent 5bfaf23 commit 1a2d8dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parser.c
Expand Up @@ -9155,6 +9155,7 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
in++;
col++;
if (len != NULL) {
if (alloc) *alloc = 0;
*len = last - start;
ret = (xmlChar *) start;
} else {
Expand All @@ -9164,7 +9165,6 @@ xmlParseAttValueInternal(xmlParserCtxtPtr ctxt, int *len, int *alloc,
CUR_PTR = in;
ctxt->input->line = line;
ctxt->input->col = col;
if (alloc) *alloc = 0;
return ret;
need_complex:
if (alloc) *alloc = 1;
Expand Down

0 comments on commit 1a2d8dd

Please sign in to comment.