diff options
author | Florian Müllner <fmuellner@gnome.org> | 2019-02-19 00:00:59 +0100 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2019-02-19 02:00:24 +0100 |
commit | 034d7417994f8f8e55f52fa4887b4cd8bba2665e (patch) | |
tree | 6d3582f58d285343f6bca97965ee0fed3b23b6cf | |
parent | a637ae6569da36ce62b68a9b9db57d30eb094d04 (diff) | |
download | libcroco-034d7417994f8f8e55f52fa4887b4cd8bba2665e.tar.gz |
parser: Don't leak new parser objects on failure
cr_parser_new() may fail and return NULL. The previously allocated
memory should be freed in that case.
Spotted by covscan.
https://gitlab.gnome.org/GNOME/libcroco/merge_requests/1
-rw-r--r-- | src/cr-parser.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cr-parser.c b/src/cr-parser.c index 3899a47..44043b7 100644 --- a/src/cr-parser.c +++ b/src/cr-parser.c @@ -2761,6 +2761,8 @@ cr_parser_new (CRTknzr * a_tknzr) if (a_tknzr) { status = cr_parser_set_tknzr (result, a_tknzr); + if (status != CR_OK) + cr_parser_destroy (result); } g_return_val_if_fail (status == CR_OK, NULL); |