vl: fix resource leak with monitor_fdset_add_fd
monitor_fdset_add_fd returns an AddfdInfo struct (used by the QMP command add_fd). Free it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
		
							parent
							
								
									3ebd6cc8d3
								
							
						
					
					
						commit
						636a30a890
					
				
							
								
								
									
										6
									
								
								vl.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								vl.c
									
									
									
									
									
								
							@ -1012,6 +1012,7 @@ static int parse_add_fd(QemuOpts *opts, void *opaque)
 | 
				
			|||||||
    int fd, dupfd, flags;
 | 
					    int fd, dupfd, flags;
 | 
				
			||||||
    int64_t fdset_id;
 | 
					    int64_t fdset_id;
 | 
				
			||||||
    const char *fd_opaque = NULL;
 | 
					    const char *fd_opaque = NULL;
 | 
				
			||||||
 | 
					    AddfdInfo *fdinfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fd = qemu_opt_get_number(opts, "fd", -1);
 | 
					    fd = qemu_opt_get_number(opts, "fd", -1);
 | 
				
			||||||
    fdset_id = qemu_opt_get_number(opts, "set", -1);
 | 
					    fdset_id = qemu_opt_get_number(opts, "set", -1);
 | 
				
			||||||
@ -1061,8 +1062,9 @@ static int parse_add_fd(QemuOpts *opts, void *opaque)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* add the duplicate fd, and optionally the opaque string, to the fd set */
 | 
					    /* add the duplicate fd, and optionally the opaque string, to the fd set */
 | 
				
			||||||
    monitor_fdset_add_fd(dupfd, true, fdset_id, fd_opaque ? true : false,
 | 
					    fdinfo = monitor_fdset_add_fd(dupfd, true, fdset_id, !!fd_opaque, fd_opaque,
 | 
				
			||||||
                         fd_opaque, NULL);
 | 
					                                  &error_abort);
 | 
				
			||||||
 | 
					    g_free(fdinfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user