[PATCH 1/2] qemu-char.c: Fix memory leaks in qemu_chr_open_pty when openpty fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 qemu-char.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index 05df971..d845572 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -986,6 +986,8 @@ static CharDriverState *qemu_chr_open_pty(QemuOpts *opts)
     s = qemu_mallocz(sizeof(PtyCharDriver));
 
     if (openpty(&s->fd, &slave_fd, pty_name, NULL, NULL) < 0) {
+        qemu_free(chr);
+        qemu_free(s);
         return NULL;
     }
 
-- 
1.7.0.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux