From patchwork Wed Jan 11 17:29:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 713838 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tzGCw3kTlz9t14 for ; Thu, 12 Jan 2017 04:31:56 +1100 (AEDT) Received: from localhost ([::1]:55708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRMkc-0002HE-4B for incoming@patchwork.ozlabs.org; Wed, 11 Jan 2017 12:31:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRMj3-0000qW-U8 for qemu-devel@nongnu.org; Wed, 11 Jan 2017 12:30:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRMj2-0006M2-VJ for qemu-devel@nongnu.org; Wed, 11 Jan 2017 12:30:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57572) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cRMj2-0006Lu-PW for qemu-devel@nongnu.org; Wed, 11 Jan 2017 12:30:16 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EFC498F037 for ; Wed, 11 Jan 2017 17:30:16 +0000 (UTC) Received: from localhost ([10.41.1.232]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0BHUGFM020725; Wed, 11 Jan 2017 12:30:16 -0500 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Wed, 11 Jan 2017 18:29:29 +0100 Message-Id: <20170111172956.11255-14-marcandre.lureau@redhat.com> In-Reply-To: <20170111172956.11255-1-marcandre.lureau@redhat.com> References: <20170111172956.11255-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 11 Jan 2017 17:30:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 13/40] char-win: convert to finalize X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Marc-André Lureau --- qemu-char.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 1954dec9b8..4cbcc29bd5 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2150,8 +2150,9 @@ typedef struct { static int win_chr_poll(void *opaque); static int win_chr_pipe_poll(void *opaque); -static void win_chr_free(Chardev *chr) +static void char_win_finalize(Object *obj) { + Chardev *chr = CHARDEV(obj); WinChardev *s = WIN_CHARDEV(chr); if (s->skip_free) { @@ -2160,15 +2161,12 @@ static void win_chr_free(Chardev *chr) if (s->hsend) { CloseHandle(s->hsend); - s->hsend = NULL; } if (s->hrecv) { CloseHandle(s->hrecv); - s->hrecv = NULL; } if (s->hcom) { CloseHandle(s->hcom); - s->hcom = NULL; } if (s->fpipe) qemu_del_polling_cb(win_chr_pipe_poll, chr); @@ -2241,7 +2239,6 @@ static int win_chr_init(Chardev *chr, const char *filename, Error **errp) return 0; fail: - win_chr_free(chr); return -1; } @@ -2416,7 +2413,6 @@ static int win_chr_pipe_init(Chardev *chr, const char *filename, return 0; fail: - win_chr_free(chr); return -1; } @@ -2447,13 +2443,13 @@ static void char_win_class_init(ObjectClass *oc, void *data) ChardevClass *cc = CHARDEV_CLASS(oc); cc->chr_write = win_chr_write; - cc->chr_free = win_chr_free; } static const TypeInfo char_win_type_info = { .name = TYPE_CHARDEV_WIN, .parent = TYPE_CHARDEV, .instance_size = sizeof(WinChardev), + .instance_finalize = char_win_finalize, .class_init = char_win_class_init, .abstract = true, };