diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index e5300ef823aeab4dbbbfe006b69cc59075445397..7fc4f40521781e20ed0d507a18407a0283ae6a2f 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1175,7 +1175,6 @@ static char *console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args
 static char *console_transfer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct chan_oss_pvt *o = find_desc(oss_active);
-	RAII_VAR(struct ast_channel *, b, NULL, ast_channel_cleanup);
 	char *tmp, *ext, *ctx;
 
 	switch (cmd) {
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index cf0b07209de64eece57e64698ab12a73fcb7516d..8ed469ebea905b15b5793cfb1478258424d6c4f5 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -7202,8 +7202,6 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse
 		}
 
 		if ((sub && sub->owner) && (ast_channel_state(sub->owner) ==  AST_STATE_UP)) {
-			RAII_VAR(struct ast_channel *, bridged, NULL, ast_channel_cleanup);
-
 			c = sub->owner;
 			ast_channel_lock(c);
 			bridge_channel = ast_channel_get_bridge_channel(c);
diff --git a/main/cdr.c b/main/cdr.c
index 467969097c8249373a8416af539456c9e0b3086f..1828b0a4c9e76c58790b9d422fd8c5428bd2ebb6 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1085,7 +1085,6 @@ static struct ast_cdr *cdr_object_create_public_records(struct cdr_object *cdr)
 	struct ast_var_t *it_var, *it_copy_var;
 	struct ast_channel_snapshot *party_a;
 	struct ast_channel_snapshot *party_b;
-	RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
 
 	for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
 		struct ast_cdr *cdr_copy;
@@ -1239,9 +1238,6 @@ static void cdr_object_set_disposition(struct cdr_object *cdr, int hangupcause)
  */
 static void cdr_object_finalize(struct cdr_object *cdr)
 {
-	RAII_VAR(struct module_config *, mod_cfg,
-			ao2_global_obj_ref(module_configs), ao2_cleanup);
-
 	if (!ast_tvzero(cdr->end)) {
 		return;
 	}
@@ -1644,8 +1640,6 @@ static enum ast_cdr_disposition dial_status_to_disposition(const char *dial_stat
 
 static int dial_state_process_dial_end(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer, const char *dial_status)
 {
-	RAII_VAR(struct module_config *, mod_cfg,
-			ao2_global_obj_ref(module_configs), ao2_cleanup);
 	struct ast_channel_snapshot *party_a;
 
 	if (caller) {
diff --git a/main/pbx.c b/main/pbx.c
index b24bcd8c8d6ada34fb8cc9503588d059eb52bae3..d1611174618ba556ca2e30526c222f82880f07d2 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -4834,8 +4834,6 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
 	struct pbx_find_info q = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
 	char passdata[EXT_DATA_SIZE];
 	int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
-	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
-	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 
 	ast_rdlock_contexts();
 	if (found)
diff --git a/main/stasis_bridges.c b/main/stasis_bridges.c
index eb020163d73db5373368f42cf97b688975344dc6..1e0b36edffcd2fc4303bace00e57477e20638efc 100644
--- a/main/stasis_bridges.c
+++ b/main/stasis_bridges.c
@@ -346,11 +346,11 @@ static struct ast_json *ast_bridge_merge_message_to_json(
 		return NULL;
 	}
 
-        return ast_json_pack("{s: s, s: o, s: O, s: O}",
-                "type", "BridgeMerged",
-                "timestamp", ast_json_timeval(*stasis_message_timestamp(msg), NULL),
-                "bridge", json_bridge_to,
-                "bridge_from", json_bridge_from);
+	return ast_json_pack("{s: s, s: o, s: O, s: O}",
+		"type", "BridgeMerged",
+		"timestamp", ast_json_timeval(*stasis_message_timestamp(msg), NULL),
+		"bridge", json_bridge_to,
+		"bridge_from", json_bridge_from);
 }
 
 void ast_bridge_publish_merge(struct ast_bridge *to, struct ast_bridge *from)
@@ -466,10 +466,10 @@ void ast_bridge_publish_leave(struct ast_bridge *bridge, struct ast_channel *cha
 }
 
 static struct ast_json *simple_bridge_channel_event(
-        const char *type,
-        struct ast_bridge_snapshot *bridge_snapshot,
-        struct ast_channel_snapshot *channel_snapshot,
-        const struct timeval *tv,
+	const char *type,
+	struct ast_bridge_snapshot *bridge_snapshot,
+	struct ast_channel_snapshot *channel_snapshot,
+	const struct timeval *tv,
 	const struct stasis_message_sanitizer *sanitize)
 {
 	RAII_VAR(struct ast_json *, json_bridge,
@@ -481,31 +481,31 @@ static struct ast_json *simple_bridge_channel_event(
 		return NULL;
 	}
 
-        return ast_json_pack("{s: s, s: o, s: O, s: O}",
-                "type", type,
-                "timestamp", ast_json_timeval(*tv, NULL),
-                "bridge", json_bridge,
-                "channel", json_channel);
+	return ast_json_pack("{s: s, s: o, s: O, s: O}",
+		"type", type,
+		"timestamp", ast_json_timeval(*tv, NULL),
+		"bridge", json_bridge,
+		"channel", json_channel);
 }
 
 struct ast_json *ast_channel_entered_bridge_to_json(
 	struct stasis_message *msg,
 	const struct stasis_message_sanitizer *sanitize)
 {
-        struct ast_bridge_blob *obj = stasis_message_data(msg);
+	struct ast_bridge_blob *obj = stasis_message_data(msg);
 
 	return simple_bridge_channel_event("ChannelEnteredBridge", obj->bridge,
-                obj->channel, stasis_message_timestamp(msg), sanitize);
+		obj->channel, stasis_message_timestamp(msg), sanitize);
 }
 
 struct ast_json *ast_channel_left_bridge_to_json(
 	struct stasis_message *msg,
 	const struct stasis_message_sanitizer *sanitize)
 {
-        struct ast_bridge_blob *obj = stasis_message_data(msg);
+	struct ast_bridge_blob *obj = stasis_message_data(msg);
 
 	return simple_bridge_channel_event("ChannelLeftBridge", obj->bridge,
-                obj->channel, stasis_message_timestamp(msg), sanitize);
+		obj->channel, stasis_message_timestamp(msg), sanitize);
 }
 
 static struct ast_json *container_to_json_array(struct ao2_container *items,
diff --git a/main/stasis_channels.c b/main/stasis_channels.c
index 45ec53d7f73af05d64eeb401814bd006258d18a5..c75d174925812e7d0f01b1660ced7041cc789efe 100644
--- a/main/stasis_channels.c
+++ b/main/stasis_channels.c
@@ -716,7 +716,6 @@ static struct ast_manager_event_blob *varset_to_ami(struct stasis_message *msg)
 static struct ast_manager_event_blob *agent_login_to_ami(struct stasis_message *msg)
 {
 	RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
-	RAII_VAR(struct ast_str *, party_string, ast_str_create(256), ast_free);
 	struct ast_channel_blob *obj = stasis_message_data(msg);
 	const char *agent = ast_json_string_get(ast_json_object_get(obj->blob, "agent"));
 
@@ -734,7 +733,6 @@ static struct ast_manager_event_blob *agent_login_to_ami(struct stasis_message *
 static struct ast_manager_event_blob *agent_logoff_to_ami(struct stasis_message *msg)
 {
 	RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
-	RAII_VAR(struct ast_str *, party_string, ast_str_create(256), ast_free);
 	struct ast_channel_blob *obj = stasis_message_data(msg);
 	const char *agent = ast_json_string_get(ast_json_object_get(obj->blob, "agent"));
 	long logintime = ast_json_integer_get(ast_json_object_get(obj->blob, "logintime"));
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 7b7e80739074606adbe537bbd6d7356312944026..9d127b2ea4cfd835456460ce50e6ce7d6ee98c85 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -464,7 +464,6 @@ void ast_ari_channels_record(struct ast_variable *headers,
 	struct ast_ari_response *response)
 {
 	RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
 	RAII_VAR(char *, recording_url, NULL, ast_free);
 	struct ast_json *json;
diff --git a/res/ari/resource_recordings.c b/res/ari/resource_recordings.c
index abde4f0c0e4cdd60988705fa6f1763bd169ee0f2..bc07d55992040edec2f72bcdf4fa3433ae3597e6 100644
--- a/res/ari/resource_recordings.c
+++ b/res/ari/resource_recordings.c
@@ -166,7 +166,6 @@ static void control_recording(const char *name,
 	struct ast_ari_response *response)
 {
 	RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
-	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
 	enum stasis_app_recording_oper_results res;
 
 	recording = stasis_app_recording_find_by_name(name);
diff --git a/res/parking/parking_applications.c b/res/parking/parking_applications.c
index 85075bc5a242603f5e246c38c5bb2c099586baf9..3d2eecd297d6b3a4917ad4cd8a5c8867e6a43662 100644
--- a/res/parking/parking_applications.c
+++ b/res/parking/parking_applications.c
@@ -553,7 +553,6 @@ static int parked_call_app_exec(struct ast_channel *chan, const char *data)
 {
 	RAII_VAR(struct parking_lot *, lot, NULL, ao2_cleanup);
 	RAII_VAR(struct parked_user *, pu, NULL, ao2_cleanup); /* Parked user being retrieved */
-	RAII_VAR(struct ast_bridge *, parking_bridge, NULL, ao2_cleanup);
 	struct ast_bridge *retrieval_bridge;
 	int res;
 	int target_space = -1;
diff --git a/res/parking/parking_manager.c b/res/parking/parking_manager.c
index 70a230c562741cc2e92dd2cfcf8adcd2f69c92d9..16e286369882af7ce4382cd8a2e4f822a96289c6 100644
--- a/res/parking/parking_manager.c
+++ b/res/parking/parking_manager.c
@@ -152,7 +152,6 @@ static struct stasis_subscription *parking_sub;
 
 static struct ast_parked_call_payload *parked_call_payload_from_failure(struct ast_channel *chan)
 {
-	RAII_VAR(struct ast_parked_call_payload *, payload, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_channel_snapshot *, parkee_snapshot, NULL, ao2_cleanup);
 
 	ast_channel_lock(chan);
@@ -167,7 +166,6 @@ static struct ast_parked_call_payload *parked_call_payload_from_failure(struct a
 
 static struct ast_parked_call_payload *parked_call_payload_from_parked_user(struct parked_user *pu, enum ast_parked_call_event_type event_type)
 {
-	RAII_VAR(struct ast_parked_call_payload *, payload, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_channel_snapshot *, parkee_snapshot, NULL, ao2_cleanup);
 	long int timeout;
 	long int duration;
@@ -177,7 +175,6 @@ static struct ast_parked_call_payload *parked_call_payload_from_parked_user(stru
 	ast_channel_lock(pu->chan);
 	parkee_snapshot = ast_channel_snapshot_create(pu->chan);
 	ast_channel_unlock(pu->chan);
-
 	if (!parkee_snapshot) {
 		return NULL;
 	}
diff --git a/res/res_ari.c b/res/res_ari.c
index 133ca6689cb24de773555d5ce3c1c02c2945b377..4f16c021c5fb64a760ed93752ef347d4e10ac301 100644
--- a/res/res_ari.c
+++ b/res/res_ari.c
@@ -472,7 +472,6 @@ void ast_ari_invoke(struct ast_tcptls_session_instance *ser,
 	struct ast_variable *get_params, struct ast_variable *headers,
 	struct ast_ari_response *response)
 {
-	RAII_VAR(char *, response_text, NULL, ast_free);
 	RAII_VAR(struct stasis_rest_handlers *, root, NULL, ao2_cleanup);
 	struct stasis_rest_handlers *handler;
 	RAII_VAR(struct ast_variable *, path_vars, NULL, ast_variables_destroy);
diff --git a/res/res_fax.c b/res/res_fax.c
index e05b101f747ed25e2efc698808916cc67ecd1496..4f253b758848f33cac56749bc0d36bcf261db0b4 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -1175,7 +1175,6 @@ static char *generate_filenames_string(struct ast_fax_session_details *details,
 static int report_fax_status(struct ast_channel *chan, struct ast_fax_session_details *details, const char *status)
 {
 	RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
-	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 	struct ast_json *json_filenames = NULL;
 
diff --git a/res/res_parking.c b/res/res_parking.c
index 6d07818deef60e51ac7c109a0e9cb2f4ff0b63e5..c36d558b6e443af46f06c3ddef56440778c32b47 100644
--- a/res/res_parking.c
+++ b/res/res_parking.c
@@ -689,7 +689,6 @@ static int parking_add_extension(struct ast_context *context, int replace, const
 
 static int extension_is_compatible(struct parking_lot_cfg *lot_cfg, const char *app_type, struct ast_exten *extension)
 {
-	RAII_VAR(struct parking_lot_cfg *, owner, NULL, ao2_cleanup);
 	const char *extension_registrar = ast_get_extension_registrar(extension);
 	const char *extension_context = ast_get_context_name(ast_get_extension_context(extension));
 	const char *extension_name = ast_get_extension_name(extension);
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index e526c46658551b0094a82a3960cd14e21f883266..2cd852daaf4d54e3b263ff1a0a2fe823b74fb9f1 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -158,7 +158,6 @@ struct ast_sip_contact *ast_sip_location_retrieve_contact_from_aor_list(const ch
 
 	while ((aor_name = strsep(&rest, ","))) {
 		RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
-		RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
 
 		if (!aor) {
 			continue;
diff --git a/res/res_pjsip/security_events.c b/res/res_pjsip/security_events.c
index 5bb5af90c871568a25b5d56d7c01dd3a2616e99c..5c30e1c5e7a55f2bd599291dcd79aa922bfbac80 100644
--- a/res/res_pjsip/security_events.c
+++ b/res/res_pjsip/security_events.c
@@ -136,7 +136,6 @@ void ast_sip_report_auth_failed_challenge_response(struct ast_sip_endpoint *endp
 	char call_id[pj_strlen(&rdata->msg_info.cid->id) + 1];
 	char nonce[64] = "", response[256] = "";
 	struct ast_sockaddr local, remote;
-	RAII_VAR(struct ast_sip_endpoint *, artificial, ast_sip_get_artificial_endpoint(), ao2_cleanup);
 
 	struct ast_security_event_chal_resp_failed chal_resp_failed = {
 				.common.event_type = AST_SECURITY_EVENT_CHAL_RESP_FAILED,
diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c
index 399e9e672082ec44e650d98d76496e01eabd5626..9725caa1498f0910ed3b63bfd4363b47f03d982b 100644
--- a/res/res_pjsip_refer.c
+++ b/res/res_pjsip_refer.c
@@ -732,7 +732,6 @@ static int refer_incoming_invite_request(struct ast_sip_session *session, struct
 	int response = 0;
 	RAII_VAR(struct ast_sip_session *, other_session, NULL, ao2_cleanup);
 	struct invite_replaces invite;
-	RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
 
 	/* If a Replaces header is present make sure it is valid */
 	if (pjsip_replaces_verify_request(rdata, &other_dlg, PJ_TRUE, &packet) != PJ_SUCCESS) {
diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 067bf878125c8feec2158da3b001542b123a8234..82c7a3f229bed33baefeb88e1e59bc5ede70b2ef 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -302,7 +302,7 @@ static int validate_incoming_sdp(const pjmedia_sdp_session *sdp)
 	for (i = 0; i < sdp->media_count; ++i) {
 		RAII_VAR(int *, port, ao2_alloc(sizeof(int), NULL), ao2_cleanup);
 		RAII_VAR(int *, port_match, NULL, ao2_cleanup);
-		RAII_VAR(int *, bundle_match, NULL, ao2_cleanup);
+
 		*port = sdp->media[i]->desc.port;
 		port_match = ao2_find(portlist, port, OBJ_KEY);
 		if (port_match) {
diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c
index 299cb4483788c88f32538329de856d88dd43ea92..79c2bab9ce879ff24dde1dbfecce6e04a2c9f253 100644
--- a/res/res_stasis_playback.c
+++ b/res/res_stasis_playback.c
@@ -192,7 +192,6 @@ static const char *state_to_string(enum stasis_app_playback_state state)
 static void playback_publish(struct stasis_app_playback *playback)
 {
 	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
-	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
 	ast_assert(playback != NULL);
diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index 080ee7b8152265d09e37d9b3e61724882446c820..a256fe99949485251d7ffc3502e684f814753a47 100644
--- a/res/res_stasis_recording.c
+++ b/res/res_stasis_recording.c
@@ -211,7 +211,6 @@ enum ast_record_if_exists stasis_app_recording_if_exists_parse(
 static void recording_publish(struct stasis_app_recording *recording, const char *cause)
 {
 	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
-	RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
 	ast_assert(recording != NULL);
diff --git a/res/stasis/app.c b/res/stasis/app.c
index 54ee5898e271e8666f62cc8b996706673edfe106..d9eef4c6630091772b3f0c61203f8492028752a0 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -387,7 +387,6 @@ static struct ast_json *channel_dialplan(
 	struct ast_channel_snapshot *new_snapshot,
 	const struct timeval *tv)
 {
-	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
 	struct ast_json *json_channel;
 
 	/* No Newexten event on cache clear or first event */
@@ -422,7 +421,6 @@ static struct ast_json *channel_callerid(
 	struct ast_channel_snapshot *new_snapshot,
 	const struct timeval *tv)
 {
-	RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
 	struct ast_json *json_channel;
 
 	/* No NewCallerid event on cache clear or first event */
diff --git a/res/stasis_recording/stored.c b/res/stasis_recording/stored.c
index 255976d2850710d6868df44f0b4e4bcedce7a46a..03af06987eac6e178cc35a5c6f18ae2bf09abc5d 100644
--- a/res/stasis_recording/stored.c
+++ b/res/stasis_recording/stored.c
@@ -247,7 +247,6 @@ static int scan_file(struct ao2_container *recordings,
 {
 	RAII_VAR(struct stasis_app_stored_recording *, recording, NULL,
 		ao2_cleanup);
-	RAII_VAR(struct ast_str *, name, NULL, ast_free);
 	const char *ext;
 	char *dot;