From 92c2e1e79e730058fec446729ce8864dfba61ac7 Mon Sep 17 00:00:00 2001 From: shivanayak Date: Wed, 11 Mar 2026 15:26:16 +0530 Subject: [PATCH] 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 --- lib/drives.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/drives.c b/lib/drives.c index 6a62623d5..edb1e060f 100644 --- a/lib/drives.c +++ b/lib/drives.c @@ -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; }