mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	topology: sort_config() cleanups - use goto for the error path
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									3f63dc2644
								
							
						
					
					
						commit
						45f503632a
					
				
					 1 changed files with 7 additions and 8 deletions
				
			
		| 
						 | 
					@ -180,29 +180,28 @@ static snd_config_t *sort_config(const char *id, snd_config_t *src)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (array <= 0)
 | 
						if (array <= 0)
 | 
				
			||||||
		qsort(a, count, sizeof(a[0]), _compar);
 | 
							qsort(a, count, sizeof(a[0]), _compar);
 | 
				
			||||||
	if (snd_config_make_compound(&dst, id, count == 1)) {
 | 
						if (snd_config_make_compound(&dst, id, count == 1))
 | 
				
			||||||
		free(a);
 | 
							goto lerr;
 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	for (index = 0; index < count; index++) {
 | 
						for (index = 0; index < count; index++) {
 | 
				
			||||||
		snd_config_t *s = a[index];
 | 
							snd_config_t *s = a[index];
 | 
				
			||||||
		const char *id2;
 | 
							const char *id2;
 | 
				
			||||||
		if (snd_config_get_id(s, &id2)) {
 | 
							if (snd_config_get_id(s, &id2)) {
 | 
				
			||||||
			snd_config_delete(dst);
 | 
								snd_config_delete(dst);
 | 
				
			||||||
			free(a);
 | 
								goto lerr;
 | 
				
			||||||
			return NULL;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		s = sort_config(id2, s);
 | 
							s = sort_config(id2, s);
 | 
				
			||||||
		if (s == NULL || snd_config_add(dst, s)) {
 | 
							if (s == NULL || snd_config_add(dst, s)) {
 | 
				
			||||||
			if (s)
 | 
								if (s)
 | 
				
			||||||
				snd_config_delete(s);
 | 
									snd_config_delete(s);
 | 
				
			||||||
			snd_config_delete(dst);
 | 
								snd_config_delete(dst);
 | 
				
			||||||
			free(a);
 | 
								goto lerr;
 | 
				
			||||||
			return NULL;
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	free(a);
 | 
						free(a);
 | 
				
			||||||
	return dst;
 | 
						return dst;
 | 
				
			||||||
 | 
					lerr:
 | 
				
			||||||
 | 
						free(a);
 | 
				
			||||||
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int tplg_check_quoted(const unsigned char *p)
 | 
					static int tplg_check_quoted(const unsigned char *p)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue