[libcroco/wip/fmuellner/coverage-fixes: 9/10] statement: Fix erroneous error check



commit 207ca7218f70fffb949d35bbd7b72b2326e5534b
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 19 01:04:21 2019 +0100

    statement: Fix erroneous error check
    
    The condition was already checked above. Instead, check that the
    last method call succeeded (but without leaking earlier allocated
    memory).
    
    Spotted by covscan.
    
    https://gitlab.gnome.org/GNOME/libcroco/merge_requests/1

 src/cr-statement.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/cr-statement.c b/src/cr-statement.c
index b38c076..9d9a7a5 100644
--- a/src/cr-statement.c
+++ b/src/cr-statement.c
@@ -1067,7 +1067,8 @@ cr_statement_ruleset_parse_from_buf (const guchar * a_buf,
         g_return_val_if_fail (parser, NULL);
 
         sac_handler = cr_doc_handler_new ();
-        g_return_val_if_fail (parser, NULL);
+        if (!sac_handler)
+                goto cleanup;
 
         sac_handler->start_selector = parse_ruleset_start_selector_cb;
         sac_handler->end_selector = parse_ruleset_end_selector_cb;


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