[gupnp-av] Add null checks



commit 8e0e8148675925767be7bedf81e6c4e8185d1be5
Author: Jens Georg <mail jensge org>
Date:   Sat May 31 09:45:55 2014 +0200

    Add null checks
    
    Fixes coverity issue 60869
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731033

 libgupnp-av/fragment-util.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/libgupnp-av/fragment-util.c b/libgupnp-av/fragment-util.c
index ad15d53..6fc6be2 100644
--- a/libgupnp-av/fragment-util.c
+++ b/libgupnp-av/fragment-util.c
@@ -699,20 +699,20 @@ fragment_util_check_fragments (DocNode     *original,
                                         XML_PARSE_NONET);
         GUPnPDIDLLiteFragmentResult result;
 
-        if (current_doc == NULL) {
+        if (current_doc == NULL || current_doc->children == NULL) {
                 result = GUPNP_DIDL_LITE_FRAGMENT_RESULT_CURRENT_BAD_XML;
 
                 goto out;
         }
-        if (new_doc == NULL) {
+
+        if (new_doc == NULL || new_doc->children == NULL) {
                 result = GUPNP_DIDL_LITE_FRAGMENT_RESULT_NEW_BAD_XML;
 
                 goto out;
         }
 
         /* Assuming current_doc->children is non-NULL. */
-        if (current_doc->children != NULL &&
-            current_doc->children->children != NULL) {
+        if (current_doc->children->children != NULL) {
             /* If the child element is title or class,
              * it must not be set to empty or removed.
              */


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