From patchwork Thu Apr 15 21:41:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] qemu-char.c: Fix memory leaks in qemu_chr_open_pty when openpty fails Date: Thu, 15 Apr 2010 11:41:12 -0000 From: =?utf-8?q?Thomas_B=C3=A4chler?= X-Patchwork-Id: 50361 Message-Id: <1271367673-18975-1-git-send-email-thomas@archlinux.org> To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Thomas=20B=C3=A4chler?= , kvm@vger.kernel.org --- 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; }