virtio-scsi: Fix memory leak when realize failed
Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
							parent
							
								
									c1d4096b0f
								
							
						
					
					
						commit
						93bd49aff9
					
				@ -808,6 +808,7 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
 | 
				
			|||||||
        error_setg(errp, "Invalid number of queues (= %" PRId32 "), "
 | 
					        error_setg(errp, "Invalid number of queues (= %" PRId32 "), "
 | 
				
			||||||
                         "must be a positive integer less than %d.",
 | 
					                         "must be a positive integer less than %d.",
 | 
				
			||||||
                   s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);
 | 
					                   s->conf.num_queues, VIRTIO_PCI_QUEUE_MAX);
 | 
				
			||||||
 | 
					        virtio_cleanup(vdev);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));
 | 
					    s->cmd_vqs = g_malloc0(s->conf.num_queues * sizeof(VirtQueue *));
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user