From patchwork Thu Apr 15 21:41:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?VGhvbWFzIELDg8KkY2hsZXI=?= X-Patchwork-Id: 92968 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3FLncsN022545 for ; Thu, 15 Apr 2010 21:49:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757846Ab0DOVte (ORCPT ); Thu, 15 Apr 2010 17:49:34 -0400 Received: from gerolde.archlinux.org ([66.211.214.132]:55010 "EHLO archlinux.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757280Ab0DOVtd (ORCPT ); Thu, 15 Apr 2010 17:49:33 -0400 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Apr 2010 21:49:42 +0000 (UTC) X-Greylist: delayed 490 seconds by postgrey-1.27 at vger.kernel.org; Thu, 15 Apr 2010 17:49:33 EDT Received: from localhost.localdomain (port-87-193-186-180.static.qsc.de [87.193.186.180]) by archlinux.org (Postfix) with ESMTPSA id 24C8790152; Thu, 15 Apr 2010 17:41:20 -0400 (EDT) From: =?UTF-8?q?Thomas=20B=C3=A4chler?= To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, =?UTF-8?q?Thomas=20B=C3=A4chler?= Subject: [PATCH 1/2] qemu-char.c: Fix memory leaks in qemu_chr_open_pty when openpty fails Date: Thu, 15 Apr 2010 23:41:12 +0200 Message-Id: <1271367673-18975-1-git-send-email-thomas@archlinux.org> X-Mailer: git-send-email 1.7.0.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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; }