diff options
author | Zhenzhong Duan <zhenzhong.duan@intel.com> | 2024-05-22 12:39:58 +0800 |
---|---|---|
committer | Cédric Le Goater <clg@redhat.com> | 2024-05-22 10:04:21 +0200 |
commit | 50b632b64ce460844089ddd5061460d8b119df5d (patch) | |
tree | 2265dfcd4b7c34fc75fd0bbde85f50e319da3d99 | |
parent | 455c009dc4ec13dab51c3764332433013b5cf3cb (diff) | |
download | qemu-50b632b64ce460844089ddd5061460d8b119df5d.zip qemu-50b632b64ce460844089ddd5061460d8b119df5d.tar.gz qemu-50b632b64ce460844089ddd5061460d8b119df5d.tar.bz2 |
vfio/helpers: Use g_autofree in vfio_set_irq_signaling()
Local pointer irq_set is freed before return from
vfio_set_irq_signaling().
Use 'g_autofree' to avoid the g_free() calls.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
-rw-r--r-- | hw/vfio/helpers.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/vfio/helpers.c b/hw/vfio/helpers.c index 47b4096..1f3bdd9 100644 --- a/hw/vfio/helpers.c +++ b/hw/vfio/helpers.c @@ -111,7 +111,7 @@ int vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, int action, int fd, Error **errp) { ERRP_GUARD(); - struct vfio_irq_set *irq_set; + g_autofree struct vfio_irq_set *irq_set = NULL; int argsz, ret = 0; const char *name; int32_t *pfd; @@ -130,7 +130,6 @@ int vfio_set_irq_signaling(VFIODevice *vbasedev, int index, int subindex, if (ioctl(vbasedev->fd, VFIO_DEVICE_SET_IRQS, irq_set)) { ret = -errno; } - g_free(irq_set); if (!ret) { return 0; |