[yelp] Check variable before dereferencing it



commit 538e86cc7c1c529f838a3aa5c1f603b37a5ad8cb
Author: Tomas Popela <tpopela redhat com>
Date:   Tue Jul 24 12:45:42 2018 +0200

    Check variable before dereferencing it
    
    yelp-3.28.1/libyelp/yelp-mallard-document.c:341: var_compare_op: Comparing "path" to null implies that 
"path" might be null.
    yelp-3.28.1/libyelp/yelp-mallard-document.c:346: var_deref_op: Dereferencing null pointer "path".

 libyelp/yelp-mallard-document.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index 1302a116..b1565580 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -346,7 +346,7 @@ mallard_think (YelpMallardDocument *mallard)
          */
         error = g_error_new (YELP_ERROR, YELP_ERROR_NOT_FOUND,
                              _("The directory ā€˜%sā€™ does not exist."),
-                             path[0]);
+                             path && path[0] ? path[0] : "NULL");
        yelp_document_error_pending ((YelpDocument *) mallard, error);
         g_error_free (error);
        goto done;


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