[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 for-2.7 02/28] io: avoid double-free when closing
From: |
Daniel P. Berrange |
Subject: |
[Qemu-devel] [PATCH v6 for-2.7 02/28] io: avoid double-free when closing QIOChannelBuffer |
Date: |
Wed, 27 Apr 2016 11:04:52 +0100 |
The QIOChannelBuffer's close implementation will free
the internal data buffer. It failed to reset the pointer
to NULL though, so when the object is later finalized
it will free it a second time with predictable crash.
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Daniel P. Berrange <address@hidden>
---
io/channel-buffer.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/io/channel-buffer.c b/io/channel-buffer.c
index 3e5117b..43d7959 100644
--- a/io/channel-buffer.c
+++ b/io/channel-buffer.c
@@ -140,6 +140,7 @@ static int qio_channel_buffer_close(QIOChannel *ioc,
QIOChannelBuffer *bioc = QIO_CHANNEL_BUFFER(ioc);
g_free(bioc->data);
+ bioc->data = NULL;
bioc->capacity = bioc->usage = bioc->offset = 0;
return 0;
--
2.5.5
- [Qemu-devel] [PATCH v6 for-2.7 00/28] Convert migration to QIOChannel & support, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 01/28] s390: use FILE instead of QEMUFile for creating text file, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 02/28] io: avoid double-free when closing QIOChannelBuffer,
Daniel P. Berrange <=
- [Qemu-devel] [PATCH v6 for-2.7 04/28] migration: ensure qemu_fflush() always writes full data amount, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 05/28] migration: split migration hooks out of QEMUFileOps, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 07/28] migration: force QEMUFile to blocking mode for outgoing migration, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 08/28] migration: introduce a new QEMUFile impl based on QIOChannel, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 03/28] migration: remove use of qemu_bufopen from vmstate tests, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 12/28] migration: convert unix socket protocol to use QIOChannel, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 16/28] migration: convert exec socket protocol to use QIOChannel, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 15/28] migration: convert fd socket protocol to use QIOChannel, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 19/28] migration: delete QEMUFile buffer implementation, Daniel P. Berrange, 2016/04/27
- [Qemu-devel] [PATCH v6 for-2.7 21/28] migration: delete QEMUFile sockets implementation, Daniel P. Berrange, 2016/04/27