mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	res_geoloc: fix NULL pointer dereference bug
The `ast_geoloc_datastore_add_eprofile` function does not return 0 on success, it returns the size of the underlying datastore. This means that the datastore will be freed and its pointer set to NULL when no error occured at all. ASTERISK-30346 Change-Id: Iea9b209bd1244cc57b903b9496cb680c356e4bb9
This commit is contained in:
		
				
					committed by
					
						 Joshua Colp
						Joshua Colp
					
				
			
			
				
	
			
			
			
						parent
						
							b65aa359c4
						
					
				
				
					commit
					70c650751e
				
			| @@ -255,7 +255,7 @@ struct ast_datastore *ast_geoloc_datastore_create_from_eprofile( | ||||
| 	} | ||||
|  | ||||
| 	rc = ast_geoloc_datastore_add_eprofile(ds, eprofile); | ||||
| 	if (rc != 0) { | ||||
| 	if (rc <= 0) { | ||||
| 		ast_datastore_free(ds); | ||||
| 		ds = NULL; | ||||
| 	} | ||||
| @@ -297,7 +297,7 @@ struct ast_datastore *ast_geoloc_datastore_create_from_profile_name(const char * | ||||
|  | ||||
| 	rc = ast_geoloc_datastore_add_eprofile(ds, eprofile); | ||||
| 	ao2_ref(eprofile, -1); | ||||
| 	if (rc != 0) { | ||||
| 	if (rc <= 0) { | ||||
| 		ast_datastore_free(ds); | ||||
| 		ds = NULL; | ||||
| 	} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user