From patchwork Wed Oct 23 09:53:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: xiajidong X-Patchwork-Id: 1182319 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46yxky38Qhz9sP4 for ; Thu, 24 Oct 2019 04:12:26 +1100 (AEDT) Received: from localhost ([::1]:42036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNKBM-0002X0-2i for incoming@patchwork.ozlabs.org; Wed, 23 Oct 2019 13:12:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38359) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNDMH-0000V0-3J for qemu-devel@nongnu.org; Wed, 23 Oct 2019 05:55:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNDMF-0001Oa-Mq for qemu-devel@nongnu.org; Wed, 23 Oct 2019 05:55:12 -0400 Received: from cmccmta3.chinamobile.com ([221.176.66.81]:16160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iNDMF-0001An-2Q for qemu-devel@nongnu.org; Wed, 23 Oct 2019 05:55:11 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.9]) by rmmx-syy-dmz-app11-12011 (RichMail) with SMTP id 2eeb5db02367365-317e1; Wed, 23 Oct 2019 17:54:47 +0800 (CST) X-RM-TRANSID: 2eeb5db02367365-317e1 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from xiajidong001.localdomain (unknown[223.105.0.241]) by rmsmtp-syy-appsvr05-12005 (RichMail) with SMTP id 2ee55db0235dfb2-71dfc; Wed, 23 Oct 2019 17:54:47 +0800 (CST) X-RM-TRANSID: 2ee55db0235dfb2-71dfc From: Jidong Xia To: qemu-devel@nongnu.org Subject: [PATCH] hw/audio: fix a memory leak in OPLCreate() Date: Wed, 23 Oct 2019 17:53:40 +0800 Message-Id: <1571824420-24893-1-git-send-email-xiajidong@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 221.176.66.81 X-Mailman-Approved-At: Wed, 23 Oct 2019 13:09:41 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jidong Xia , kraxel@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There is a memory leak in OPLCreate(),Should free allocated mem before return. Signed-off-by: Jidong Xia --- hw/audio/fmopl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c index 9f50a89..ca9825b 100644 --- a/hw/audio/fmopl.c +++ b/hw/audio/fmopl.c @@ -1112,6 +1112,7 @@ FM_OPL *OPLCreate(int clock, int rate) opl_dbg_maxchip++; } #endif + free(ptr); return OPL; }