From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXt1y-0001A7-Ab for qemu-devel@nongnu.org; Thu, 11 Aug 2016 12:40:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXt1w-0008MC-E4 for qemu-devel@nongnu.org; Thu, 11 Aug 2016 12:40:29 -0400 Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:34018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXt1w-0008M8-9K for qemu-devel@nongnu.org; Thu, 11 Aug 2016 12:40:28 -0400 Received: by mail-oi0-x22b.google.com with SMTP id l203so1499196oib.1 for ; Thu, 11 Aug 2016 09:40:28 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <777265882.1234102.1470933253966.JavaMail.zimbra@redhat.com> References: <777265882.1234102.1470933253966.JavaMail.zimbra@redhat.com> From: Ashijeet Acharya Date: Thu, 11 Aug 2016 22:10:27 +0530 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] Dangling change state handler while hot unplugging ahci adapter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: John Snow , QEMU Developers On Thu, Aug 11, 2016 at 10:04 PM, Paolo Bonzini wrote: > >> I think we should do >> >> s->vmstate = qemu_add_vm_change_state_handler(ide_restart_cb, bus); >> instead of >> qemu_add_vm_change_state_handler(ide_restart_cb, bus); >> >> in ide_register_restart_cb() in hw/ide/core.c to store the returned >> pointer to memory to avoid a possible memory leak I guess and >> introduce a VMChangeStateEntry field in struct AHCIState to handle >> this. Same can then further be used with >> qemu_del_vm_change_state_handler() in ahci_unrealize() to free things >> up. > > Yes, this is correct. Thanks! > Alright I will make these changes and include them in my patch. Ashijeet > Paolo