From patchwork Wed May 18 12:05:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 9118291 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 56B43BF29F for ; Wed, 18 May 2016 12:23:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD36920160 for ; Wed, 18 May 2016 12:23:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E684620138 for ; Wed, 18 May 2016 12:23:45 +0000 (UTC) Received: from localhost ([::1]:44574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b30Vt-0008AH-49 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 May 2016 08:23:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b30Mp-00007v-Lk for qemu-devel@nongnu.org; Wed, 18 May 2016 08:14:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b30Mk-000311-Qo for qemu-devel@nongnu.org; Wed, 18 May 2016 08:14:23 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:48103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b30Mk-00030U-In; Wed, 18 May 2016 08:14:18 -0400 Received: from tsrv.tls.msk.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 64078417A5; Wed, 18 May 2016 15:14:17 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.tls.msk.ru (Postfix) with SMTP id 7FFF4AE0; Wed, 18 May 2016 15:06:11 +0300 (MSK) Received: (nullmailer pid 12386 invoked by uid 1000); Wed, 18 May 2016 12:06:09 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Wed, 18 May 2016 15:05:58 +0300 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Subject: [Qemu-devel] [PULL 03/13] loader: fix potential memory leak X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Cao jin , Michael Tokarev Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Cao jin Signed-off-by: Cao jin Signed-off-by: Michael Tokarev --- hw/core/loader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/core/loader.c b/hw/core/loader.c index c049957..53e0e41 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -914,10 +914,16 @@ int rom_add_file(const char *file, const char *fw_dir, err: if (fd != -1) close(fd); + g_free(rom->data); g_free(rom->path); g_free(rom->name); + if (fw_dir) { + g_free(rom->fw_dir); + g_free(rom->fw_file); + } g_free(rom); + return -1; }