mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	conf: fix memory leak in snd_config_substitute() for strings
When destination type is SND_CONFIG_TYPE_STRING, the old string must be freed. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									50140120c6
								
							
						
					
					
						commit
						3e5a894378
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -1741,6 +1741,8 @@ int snd_config_substitute(snd_config_t *dst, snd_config_t *src)
 | 
				
			||||||
		src->u.compound.fields.prev->next = &dst->u.compound.fields;
 | 
							src->u.compound.fields.prev->next = &dst->u.compound.fields;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	free(dst->id);
 | 
						free(dst->id);
 | 
				
			||||||
 | 
						if (dst->type == SND_CONFIG_TYPE_STRING)
 | 
				
			||||||
 | 
							free(dst->u.string);
 | 
				
			||||||
	dst->id = src->id;
 | 
						dst->id = src->id;
 | 
				
			||||||
	dst->type = src->type;
 | 
						dst->type = src->type;
 | 
				
			||||||
	dst->u = src->u;
 | 
						dst->u = src->u;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue