char: clean up remaining chardevs when leaving
This helps to remove various chardev resources leaks when leaving qemu. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1466105332-10285-2-git-send-email-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									25f0d2aa5e
								
							
						
					
					
						commit
						c1111a24a3
					
				
							
								
								
									
										11
									
								
								qemu-char.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								qemu-char.c
									
									
									
									
									
								
							| @ -4549,6 +4549,15 @@ void qmp_chardev_remove(const char *id, Error **errp) | ||||
|     qemu_chr_delete(chr); | ||||
| } | ||||
| 
 | ||||
| static void qemu_chr_cleanup(void) | ||||
| { | ||||
|     CharDriverState *chr, *tmp; | ||||
| 
 | ||||
|     QTAILQ_FOREACH_SAFE(chr, &chardevs, next, tmp) { | ||||
|         qemu_chr_delete(chr); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static void register_types(void) | ||||
| { | ||||
|     register_char_driver("null", CHARDEV_BACKEND_KIND_NULL, NULL, | ||||
| @ -4595,6 +4604,8 @@ static void register_types(void) | ||||
|      * is specified | ||||
|      */ | ||||
|     qemu_add_machine_init_done_notifier(&muxes_realize_notify); | ||||
| 
 | ||||
|     atexit(qemu_chr_cleanup); | ||||
| } | ||||
| 
 | ||||
| type_init(register_types); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Marc-André Lureau
						Marc-André Lureau