[libcroco/wip/fmuellner/coverage-fixes: 9/12] statement: Fix string leaks in error case



commit 37ffccd9626ded2b7a8c9a0dc07e4c59e77a4b10
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 19 01:00:26 2019 +0100

    statement: Fix string leaks in error case
    
    Spotted by covscan.
    
    https://gitlab.gnome.org/GNOME/libcroco/merge_requests/1

 src/cr-statement.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/cr-statement.c b/src/cr-statement.c
index 00430d5..8463fcb 100644
--- a/src/cr-statement.c
+++ b/src/cr-statement.c
@@ -201,6 +201,8 @@ parse_page_property_cb (CRDocHandler * a_this,
         g_return_if_fail (name);
 
         decl = cr_declaration_new (stmt, name, a_expression);
+        if (!decl)
+                cr_string_destroy(name);
         g_return_if_fail (decl);
         decl->important = a_important;
         stmt->kind.page_rule->decl_list =
@@ -327,6 +329,8 @@ parse_at_media_property_cb (CRDocHandler * a_this,
         g_return_if_fail (name);
 
         decl = cr_declaration_new (stmt, name, a_value);
+        if (!decl)
+                cr_string_destroy(name);
         g_return_if_fail (decl);
         decl->important = a_important;
         status = cr_statement_ruleset_append_decl (stmt, decl);
@@ -434,6 +438,8 @@ parse_ruleset_property_cb (CRDocHandler * a_this,
         g_return_if_fail (stringue);
 
         decl = cr_declaration_new (ruleset, stringue, a_value);
+        if (!decl)
+                cr_string_destroy (stringue);
         g_return_if_fail (decl);
         decl->important = a_important;
         status = cr_statement_ruleset_append_decl (ruleset, decl);


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