mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	route: Fix invalid pointer access
An uninitialized chmap pointer value is assigned in _snd_pcm_route_open(). Add NULL initializations appropriately, and also avoid the possible invalid access of NULL pcmp pointer. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
		
							parent
							
								
									d794af65e9
								
							
						
					
					
						commit
						dbe6d7f869
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -1361,7 +1361,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	snd_pcm_t *spcm;
 | 
						snd_pcm_t *spcm;
 | 
				
			||||||
	snd_config_t *slave = NULL, *sconf;
 | 
						snd_config_t *slave = NULL, *sconf;
 | 
				
			||||||
	snd_pcm_chmap_t *tt_chmap, *chmap;
 | 
						snd_pcm_chmap_t *tt_chmap = NULL, *chmap = NULL;
 | 
				
			||||||
	snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
 | 
						snd_pcm_format_t sformat = SND_PCM_FORMAT_UNKNOWN;
 | 
				
			||||||
	int schannels = -1;
 | 
						int schannels = -1;
 | 
				
			||||||
	snd_config_t *tt = NULL;
 | 
						snd_config_t *tt = NULL;
 | 
				
			||||||
| 
						 | 
					@ -1460,8 +1460,9 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
 | 
				
			||||||
	if (err < 0) {
 | 
						if (err < 0) {
 | 
				
			||||||
		free(chmap);
 | 
							free(chmap);
 | 
				
			||||||
		snd_pcm_close(spcm);
 | 
							snd_pcm_close(spcm);
 | 
				
			||||||
	}
 | 
						} else {
 | 
				
			||||||
		((snd_pcm_route_t*) (*pcmp)->private_data)->chmap = chmap;
 | 
							((snd_pcm_route_t*) (*pcmp)->private_data)->chmap = chmap;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue