diff --git a/channels/chan_motif.c b/channels/chan_motif.c
index a197dc700ed77fb061175a026caf3e472933422a..313c66cf2bf4e50f5aa9e44ebc13159a4e87d1d1 100644
--- a/channels/chan_motif.c
+++ b/channels/chan_motif.c
@@ -2564,6 +2564,8 @@ static int load_module(void)
 	if (aco_process_config(&cfg_info, 0)) {
 		ast_log(LOG_ERROR, "Unable to read config file motif.conf. Not loading module.\n");
 		aco_info_destroy(&cfg_info);
+		ast_format_cap_destroy(jingle_tech.capabilities);
+		jingle_tech.capabilities = NULL;
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
@@ -2594,6 +2596,10 @@ end:
 	}
 
 	aco_info_destroy(&cfg_info);
+	ao2_global_obj_release(globals);
+
+	ast_format_cap_destroy(jingle_tech.capabilities);
+	jingle_tech.capabilities = NULL;
 
 	return AST_MODULE_LOAD_FAILURE;
 }