[libcroco/wip/fmuellner/coverage-fixes: 11/12] statement: Fix erroneous error check



commit 0e7ee166fe1988f6d7966cf1aaae8e54d93c679c
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]