[libxml2] parser: Fix potential memory leak in xmlParseAttValueInternal
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] parser: Fix potential memory leak in xmlParseAttValueInternal
- Date: Tue, 11 Oct 2022 11:15:34 +0000 (UTC)
commit 1a2d8ddc066143d256fdb8cc554707fe141dd2f6
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Tue Oct 11 13:02:47 2022 +0200
parser: Fix potential memory leak in xmlParseAttValueInternal
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.
parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/parser.c b/parser.c
index 7bb47366..337e62f6 100644
--- a/parser.c
+++ b/parser.c
@@ -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 {
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]