virtio: Drop superfluous conditionals around g_free()
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
63122df231
commit
9e28840658
|
@ -299,9 +299,7 @@ static int v9fs_xattr_fid_clunk(V9fsPDU *pdu, V9fsFidState *fidp)
|
||||||
free_out:
|
free_out:
|
||||||
v9fs_string_free(&fidp->fs.xattr.name);
|
v9fs_string_free(&fidp->fs.xattr.name);
|
||||||
free_value:
|
free_value:
|
||||||
if (fidp->fs.xattr.value) {
|
g_free(fidp->fs.xattr.value);
|
||||||
g_free(fidp->fs.xattr.value);
|
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1509,14 +1509,10 @@ void virtio_net_set_netclient_name(VirtIONet *n, const char *name,
|
||||||
*/
|
*/
|
||||||
assert(type != NULL);
|
assert(type != NULL);
|
||||||
|
|
||||||
if (n->netclient_name) {
|
g_free(n->netclient_name);
|
||||||
g_free(n->netclient_name);
|
n->netclient_name = NULL;
|
||||||
n->netclient_name = NULL;
|
g_free(n->netclient_type);
|
||||||
}
|
n->netclient_type = NULL;
|
||||||
if (n->netclient_type) {
|
|
||||||
g_free(n->netclient_type);
|
|
||||||
n->netclient_type = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
n->netclient_name = g_strdup(name);
|
n->netclient_name = g_strdup(name);
|
||||||
|
@ -1616,14 +1612,10 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
|
||||||
|
|
||||||
unregister_savevm(dev, "virtio-net", n);
|
unregister_savevm(dev, "virtio-net", n);
|
||||||
|
|
||||||
if (n->netclient_name) {
|
g_free(n->netclient_name);
|
||||||
g_free(n->netclient_name);
|
n->netclient_name = NULL;
|
||||||
n->netclient_name = NULL;
|
g_free(n->netclient_type);
|
||||||
}
|
n->netclient_type = NULL;
|
||||||
if (n->netclient_type) {
|
|
||||||
g_free(n->netclient_type);
|
|
||||||
n->netclient_type = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(n->mac_table.macs);
|
g_free(n->mac_table.macs);
|
||||||
g_free(n->vlans);
|
g_free(n->vlans);
|
||||||
|
|
|
@ -295,9 +295,7 @@ static inline void vhost_dev_log_resize(struct vhost_dev* dev, uint64_t size)
|
||||||
if (dev->log_size) {
|
if (dev->log_size) {
|
||||||
vhost_log_sync_range(dev, 0, dev->log_size * VHOST_LOG_CHUNK - 1);
|
vhost_log_sync_range(dev, 0, dev->log_size * VHOST_LOG_CHUNK - 1);
|
||||||
}
|
}
|
||||||
if (dev->log) {
|
g_free(dev->log);
|
||||||
g_free(dev->log);
|
|
||||||
}
|
|
||||||
dev->log = log;
|
dev->log = log;
|
||||||
dev->log_size = size;
|
dev->log_size = size;
|
||||||
}
|
}
|
||||||
|
@ -601,9 +599,7 @@ static int vhost_migration_log(MemoryListener *listener, int enable)
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if (dev->log) {
|
g_free(dev->log);
|
||||||
g_free(dev->log);
|
|
||||||
}
|
|
||||||
dev->log = NULL;
|
dev->log = NULL;
|
||||||
dev->log_size = 0;
|
dev->log_size = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1164,10 +1164,8 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq)
|
||||||
|
|
||||||
void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name)
|
void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name)
|
||||||
{
|
{
|
||||||
if (vdev->bus_name) {
|
g_free(vdev->bus_name);
|
||||||
g_free(vdev->bus_name);
|
vdev->bus_name = NULL;
|
||||||
vdev->bus_name = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bus_name) {
|
if (bus_name) {
|
||||||
vdev->bus_name = g_strdup(bus_name);
|
vdev->bus_name = g_strdup(bus_name);
|
||||||
|
@ -1206,10 +1204,8 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vdev->bus_name) {
|
g_free(vdev->bus_name);
|
||||||
g_free(vdev->bus_name);
|
vdev->bus_name = NULL;
|
||||||
vdev->bus_name = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void virtio_device_class_init(ObjectClass *klass, void *data)
|
static void virtio_device_class_init(ObjectClass *klass, void *data)
|
||||||
|
|
Loading…
Reference in a new issue