mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-03 20:38:59 +00:00 
			
		
		
		
	Refactor code and fix a reference leak
Refactor some channel blob publishing code to use ast_channel_publish_blob now that it is available and fix a JSON reference leak that was occurring during varset publishing. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@390317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		@@ -76,7 +76,6 @@ static int userevent_exec(struct ast_channel *chan, const char *data)
 | 
			
		||||
		AST_APP_ARG(extra)[100];
 | 
			
		||||
	);
 | 
			
		||||
	RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref);
 | 
			
		||||
	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 | 
			
		||||
 | 
			
		||||
	if (ast_strlen_zero(data)) {
 | 
			
		||||
		ast_log(LOG_WARNING, "UserEvent requires an argument (eventname,optional event body)\n");
 | 
			
		||||
@@ -115,14 +114,7 @@ static int userevent_exec(struct ast_channel *chan, const char *data)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	msg = ast_channel_blob_create(
 | 
			
		||||
		chan, ast_channel_user_event_type(), blob);
 | 
			
		||||
	if (!msg) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	stasis_publish(ast_channel_topic(chan), msg);
 | 
			
		||||
 | 
			
		||||
	ast_channel_publish_blob(chan, ast_channel_user_event_type(), blob);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user