[libcroco/wip/fmuellner/coverage-fixes: 5/12] om-parser: Fix double-free in error case



commit f4279b88bcd8e40fd7a6dfd5c01c35489025cdcf
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 19 00:12:08 2019 +0100

    om-parser: Fix double-free in error case
    
    Freeing decl is already handled under the error label, so don't free
    it before the jump.
    
    Spotted by coverage.
    
    https://gitlab.gnome.org/GNOME/libcroco/merge_requests/1

 src/cr-om-parser.c | 3 ---
 1 file changed, 3 deletions(-)
---
diff --git a/src/cr-om-parser.c b/src/cr-om-parser.c
index ccc45b3..348cd1f 100644
--- a/src/cr-om-parser.c
+++ b/src/cr-om-parser.c
@@ -681,7 +681,6 @@ property (CRDocHandler * a_this,
                 decl2 = cr_declaration_append
                         (ctxt->cur_stmt->kind.ruleset->decl_list, decl);
                 if (!decl2) {
-                        cr_declaration_destroy (decl);
                         cr_utils_trace_info
                                 ("Could not append decl to ruleset");
                         goto error;
@@ -696,7 +695,6 @@ property (CRDocHandler * a_this,
                         (ctxt->cur_stmt->kind.font_face_rule->decl_list,
                          decl);
                 if (!decl2) {
-                        cr_declaration_destroy (decl);
                         cr_utils_trace_info
                                 ("Could not append decl to ruleset");
                         goto error;
@@ -709,7 +707,6 @@ property (CRDocHandler * a_this,
                 decl2 = cr_declaration_append
                         (ctxt->cur_stmt->kind.page_rule->decl_list, decl);
                 if (!decl2) {
-                        cr_declaration_destroy (decl);
                         cr_utils_trace_info
                                 ("Could not append decl to ruleset");
                         goto error;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]