diff mbox

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

Message ID 1271367673-18975-1-git-send-email-thomas@archlinux.org (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Bächler April 15, 2010, 9:41 p.m. UTC
None
diff mbox

Patch

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;
     }