mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	res_pjsip_sdp_rtp fix leaking astobj2 ast_format
PR #700 added a preferred_format for the struct ast_rtp_codecs,
but when set the preferred_format it leaks an astobj2 ast_format.
In the next code
ast_rtp_codecs_set_preferred_format(&codecs, ast_format_cap_get_format(joint, 0));
both functions ast_rtp_codecs_set_preferred_format
and ast_format_cap_get_format increases the ao2 reference count.
Fixes: #856
(cherry picked from commit 6ef4548223)
			
			
This commit is contained in:
		
				
					committed by
					
						 Asterisk Development Team
						Asterisk Development Team
					
				
			
			
				
	
			
			
			
						parent
						
							89bdcf0112
						
					
				
				
					commit
					045d6c5fc1
				
			| @@ -544,7 +544,10 @@ static int set_caps(struct ast_sip_session *session, | ||||
| 			ast_format_cap_get_names(caps, &usbuf), | ||||
| 			ast_format_cap_get_names(peer, &thembuf)); | ||||
| 	} else { | ||||
| 		ast_rtp_codecs_set_preferred_format(&codecs, ast_format_cap_get_format(joint, 0)); | ||||
| 		struct ast_format *preferred_fmt = ast_format_cap_get_format(joint, 0); | ||||
|  | ||||
| 		ast_rtp_codecs_set_preferred_format(&codecs, preferred_fmt); | ||||
| 		ao2_ref(preferred_fmt, -1); | ||||
| 	} | ||||
|  | ||||
| 	if (is_offer) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user