From 758340a6e1bc045fa4a7ba06b6da8e94243ee871 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Mon, 26 Jun 2017 13:47:16 +0000 Subject: [PATCH] regedit: Free the buffer and reset data information on error and after setting the value. Signed-off-by: Hugh McMaster Signed-off-by: Alexandre Julliard --- programs/regedit/regproc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index bc488d3cdb5..d6ea5c7ea30 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -758,6 +758,9 @@ static WCHAR *string_data_state(struct parser *parser, WCHAR *pos) return line; invalid: + parser->data = NULL; + parser->data_size = 0; + set_state(parser, LINE_START); return line; } @@ -781,6 +784,7 @@ static WCHAR *dword_data_state(struct parser *parser, WCHAR *pos) invalid: HeapFree(GetProcessHeap(), 0, parser->data); parser->data = NULL; + parser->data_size = 0; set_state(parser, LINE_START); return line; @@ -807,6 +811,10 @@ static WCHAR *hex_data_state(struct parser *parser, WCHAR *pos) return line; invalid: + HeapFree(GetProcessHeap(), 0, parser->data); + parser->data = NULL; + parser->data_size = 0; + set_state(parser, LINE_START); return line; } @@ -827,10 +835,10 @@ static WCHAR *set_value_state(struct parser *parser, WCHAR *pos) parser->data, parser->data_size); if (parser->parse_type == REG_DWORD || parser->parse_type == REG_BINARY) - { HeapFree(GetProcessHeap(), 0, parser->data); - parser->data = NULL; - } + + parser->data = NULL; + parser->data_size = 0; if (parser->reg_version == REG_VERSION_31) set_state(parser, PARSE_WIN31_LINE);