[Libvirt-cim] [PATCH 2/2] libcmpiutil, fix a potential debug print crash

Wenchao Xia xiawenc at linux.vnet.ibm.com
Tue Oct 30 10:24:41 UTC 2012


Signed-off-by: Wenchao Xia <xiawenc at linux.vnet.ibm.com>
---
 std_indication.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/std_indication.c b/std_indication.c
index f9dbea4..3585864 100644
--- a/std_indication.c
+++ b/std_indication.c
@@ -141,7 +141,12 @@ static CMPIStatus raise(struct std_indication_ctx *ctx,
 
         enabled = is_ind_enabled(ctx, ind_name, &s);
         if (s.rc != CMPI_RC_OK) {
-                CU_DEBUG("Problem checking enabled: '%s'", CMGetCharPtr(s.msg));
+                if (s.msg != NULL) {
+                        CU_DEBUG("Problem checking enabled: '%s'",
+                                                   CMGetCharPtr(s.msg));
+                } else {
+                        CU_DEBUG("Problem checking enabled, msg is NULL");
+                }
                 goto out;
         }
 
@@ -176,7 +181,12 @@ CMPIStatus stdi_deliver(const CMPIBroker *broker,
 
         enabled = is_ind_enabled(args->_ctx, ind_name, &s);
         if (s.rc != CMPI_RC_OK) {
-                CU_DEBUG("Problem checking enabled: '%s'", CMGetCharPtr(s.msg));
+                if (s.msg != NULL) {
+                        CU_DEBUG("Problem checking enabled: '%s'",
+                                                  CMGetCharPtr(s.msg));
+                } else {
+                        CU_DEBUG("Problem checking enabled, msg is NULL.");
+                }
                 goto out;
         }
 
-- 
1.7.1




More information about the Libvirt-cim mailing list