aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-12-08 19:32:42 +0300
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-01-31 13:01:47 +0400
commit53a5736f949a47fa7d890baf8472824263682c92 (patch)
tree7e2aff086e3818e06ca54006974c1891c00caffe /qemu-char.c
parentc266d94e7b271c90bed0be21fc45a8bb57c03313 (diff)
char-win: convert to finalize
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 83636d76c0..0cece8a34f 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,
};