resource-c: fix a crash in API test app.
authorIsmo Puustinen <ismo.puustinen@intel.com>
Thu, 11 Apr 2013 10:27:00 +0000 (13:27 +0300)
committerIsmo Puustinen <ismo.puustinen@intel.com>
Thu, 11 Apr 2013 10:27:00 +0000 (13:27 +0300)
src/plugins/resource-native/libmurphy-resource/api_test.c

index c1f46a0..bfbd968 100644 (file)
@@ -117,6 +117,8 @@ void giveup_resources(my_app_data *app_data)
     /* release resources */
     if (app_data->rs)
         mrp_res_release_resource_set(app_data->cx, app_data->rs);
+    else
+        printf("No release set acquired!\n");
 }
 
 static void state_callback(mrp_res_context_t *context,
@@ -179,6 +181,9 @@ static void state_callback(mrp_res_context_t *context,
 
                     attributes = mrp_res_list_attribute_names(context, resource);
 
+                    if (!attributes)
+                        continue;
+
                     for (j = 0; j < attributes->num_strings; j++) {
                         attr = mrp_res_get_attribute_by_name(context,
                                 resource,