mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	ucm: make verb comments optional
avoid seg fault if no comment is provided Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									32f9d7f47b
								
							
						
					
					
						commit
						a16008023e
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -777,12 +777,17 @@ static int parse_verb_file(snd_use_case_mgr_t *uc_mgr,
 | 
			
		|||
	INIT_LIST_HEAD(&verb->modifier_list);
 | 
			
		||||
	INIT_LIST_HEAD(&verb->value_list);
 | 
			
		||||
	list_add_tail(&verb->list, &uc_mgr->verb_list);
 | 
			
		||||
	if (use_case_name == NULL)
 | 
			
		||||
		return -EINVAL;
 | 
			
		||||
	verb->name = strdup(use_case_name);
 | 
			
		||||
	if (verb->name == NULL)
 | 
			
		||||
		return -ENOMEM;
 | 
			
		||||
	verb->comment = strdup(comment);
 | 
			
		||||
	if (verb->comment == NULL)
 | 
			
		||||
		return -ENOMEM;
 | 
			
		||||
 | 
			
		||||
	if (comment != NULL) {
 | 
			
		||||
		verb->comment = strdup(comment);
 | 
			
		||||
		if (verb->comment == NULL)
 | 
			
		||||
			return -ENOMEM;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* open Verb file for reading */
 | 
			
		||||
	snprintf(filename, sizeof(filename), "%s/%s/%s",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue