[libcroco/wip/fmuellner/coverage-fixes: 8/10] statement: Don't leak new statement objects on failure



commit 0e68669b4604f0920a2383871218cdb708b5a14d
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 19 01:02:06 2019 +0100

    statement: Don't leak new statement objects on failure
    
    cr_statement_new_with_media_rule() 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

 src/cr-statement.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/src/cr-statement.c b/src/cr-statement.c
index 8463fcb..b38c076 100644
--- a/src/cr-statement.c
+++ b/src/cr-statement.c
@@ -1310,6 +1310,7 @@ cr_statement_new_at_media_rule (CRStyleSheet * a_sheet,
         return result;
 
       error:
+        g_clear_pointer (&result, cr_statement_destroy);
         return NULL;
 }
 


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