diff --git a/main/endpoints.c b/main/endpoints.c
index a5d50cfde6324a5d89c8c1e257528737f111cc9b..9f6d2c06213f3db5db2f96ba3e0babdf03978a5f 100644
--- a/main/endpoints.c
+++ b/main/endpoints.c
@@ -116,6 +116,9 @@ static void endpoint_dtor(void *obj)
 	ao2_cleanup(endpoint->topic);
 	endpoint->topic = NULL;
 
+	ao2_cleanup(endpoint->channel_ids);
+	endpoint->channel_ids = NULL;
+
 	ast_string_field_free_memory(endpoint);
 }
 
@@ -357,6 +360,7 @@ struct ast_endpoint_snapshot *ast_endpoint_snapshot_create(
 		RAII_VAR(char *, channel_id, obj, ao2_cleanup);
 		snapshot->channel_ids[snapshot->num_channels++] = channel_id;
 	}
+	ao2_iterator_destroy(&i);
 
 	ao2_ref(snapshot, +1);
 	return snapshot;
diff --git a/main/format.c b/main/format.c
index 36aa534c00fa617b25e1d515c93b5607b156bc5c..5b8b8b05fe89f002317458470073f2dd9e206809 100644
--- a/main/format.c
+++ b/main/format.c
@@ -912,7 +912,7 @@ static struct ast_cli_entry my_clis[] = {
 
 static int format_list_add_custom(struct ast_format_list *new)
 {
-	struct ast_format_list *entry;
+	RAII_VAR(struct ast_format_list *, entry, NULL, ao2_cleanup);
 	if (!(entry = ao2_alloc(sizeof(*entry), NULL))) {
 		return -1;
 	}
diff --git a/main/loader.c b/main/loader.c
index be08d7f962ca89415f50a6ba1102ccca934d9747..86735df52eea4f95c0c39eddf9e84a5012d73049 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -1110,6 +1110,8 @@ static int load_resource_list(struct load_order *load_order, unsigned int global
 			break;
 		case AST_MODULE_LOAD_PRIORITY:
 			AST_LIST_REMOVE_CURRENT(entry);
+			ast_free(order->resource);
+			ast_free(order);
 			break;
 		}
 	}