[libcroco/wip/fmuellner/coverage-fixes: 2/12] parser: Don't leak error in error case
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libcroco/wip/fmuellner/coverage-fixes: 2/12] parser: Don't leak error in error case
- Date: Tue, 19 Feb 2019 01:02:32 +0000 (UTC)
commit a637ae6569da36ce62b68a9b9db57d30eb094d04
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Feb 18 23:47:11 2019 +0100
parser: Don't leak error in error case
RECORD_INITIAL_POS() returns in case of failure, and we leak the
previously created error as a result.
Fix by calling the macro before allocating the error.
Spotted by covscan.
https://gitlab.gnome.org/GNOME/libcroco/merge_requests/1
src/cr-parser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/cr-parser.c b/src/cr-parser.c
index 65052b2..3899a47 100644
--- a/src/cr-parser.c
+++ b/src/cr-parser.c
@@ -525,12 +525,12 @@ cr_parser_push_error (CRParser * a_this,
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_msg, CR_BAD_PARAM_ERROR);
+ RECORD_INITIAL_POS (a_this, &pos);
+
error = cr_parser_error_new (a_msg, a_status);
g_return_val_if_fail (error, CR_ERROR);
- RECORD_INITIAL_POS (a_this, &pos);
-
cr_parser_error_set_pos
(error, pos.line, pos.col, pos.next_byte_index - 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]