lib: fix drive struct leak on hotplug error in guestfs_impl_add_drive_opts (#318)

When guestfs_impl_add_drive_opts is called outside CONFIG state, the
hotplug error path returns -1 without freeing the already-allocated
drv structure.

Co-authored-by: Claude Local LLM <noreply@anthropic.com>
This commit is contained in:
shivanayak
2026-03-11 15:26:16 +05:30
committed by GitHub
parent 2bc54b40f7
commit 92c2e1e79e

View File

@@ -820,6 +820,7 @@ guestfs_impl_add_drive_opts (guestfs_h *g,
/* ... else the old hotplugging case */
error (g, _("hotplugging support was removed in libguestfs 1.48"));
free_drive_struct (drv);
return -1;
}