Skip to content

Commit

Permalink
libvirtio: free memory on error
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
Axel Heider authored and kent-mcleod committed May 29, 2023
1 parent 58dbcc6 commit 5a5bfb1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions libs/libvirtio/src/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ virtio_con_t *virtio_console_init(vm_t *vm, console_putchar_fn_t putchar,
err = vm_register_irq(vm->vcpus[BOOT_VCPU], VIRTIO_CON_PLAT_INTERRUPT_LINE, &virtio_console_ack, NULL);
if (err) {
ZF_LOGE("Failed to register console irq");
free(console_cookie);
return NULL;
}
return virtio_con;
Expand Down
1 change: 1 addition & 0 deletions libs/libvirtio/src/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ virtio_net_t *virtio_net_init(vm_t *vm, virtio_net_callbacks_t *callbacks,
VIRTIO_INTERRUPT_PIN, VIRTIO_NET_PLAT_INTERRUPT_LINE, backend);
if (virtio_net == NULL) {
ZF_LOGE("Failed to initialise virtio net driver");
free(driver_cookie);
return NULL;
}
driver_cookie->virtio_net = virtio_net;
Expand Down

0 comments on commit 5a5bfb1

Please sign in to comment.