Replace most uses of ast_register_atexit with ast_register_cleanup.
[asterisk/asterisk.git] / main / ccss.c
index 9fcabfe..7f63690 100644 (file)
@@ -1032,8 +1032,15 @@ static int cc_publish(struct stasis_message_type *message_type, int core_id, str
        RAII_VAR(struct ast_json_payload *, payload, NULL, ao2_cleanup);
        RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
+       if (!message_type) {
+               return -1;
+       }
+
        blob = ast_json_pack("{s: i}",
                "core_id", core_id);
+       if (!blob) {
+               return -1;
+       }
 
        if (extras) {
                ast_json_object_update(blob, extras);
@@ -4681,7 +4688,7 @@ int ast_cc_init(void)
        initialize_cc_devstate_map();
        res |= ast_devstate_prov_add("ccss", ccss_device_state);
 
-       ast_register_atexit(cc_shutdown);
+       ast_register_cleanup(cc_shutdown);
 
        return res;
 }