From nobody Mon May 6 15:22:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490092016726519.0135372204546; Tue, 21 Mar 2017 03:26:56 -0700 (PDT) Received: from localhost ([::1]:38564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqH0B-0007Eu-AB for importer@patchew.org; Tue, 21 Mar 2017 06:26:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqGzN-0007Do-NU for qemu-devel@nongnu.org; Tue, 21 Mar 2017 06:26:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqGzI-0002D6-VI for qemu-devel@nongnu.org; Tue, 21 Mar 2017 06:26:05 -0400 Received: from [59.151.112.132] (port=5818 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqGzI-00028m-JO for qemu-devel@nongnu.org; Tue, 21 Mar 2017 06:26:00 -0400 Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 21 Mar 2017 18:25:49 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 930E849F9A75; Tue, 21 Mar 2017 18:25:47 +0800 (CST) Received: from localhost.local (10.167.225.76) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 21 Mar 2017 18:25:46 +0800 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="16807080" From: Mao Zhongyi To: Date: Tue, 21 Mar 2017 18:19:41 +0800 Message-ID: <1490091581-21912-1-git-send-email-maozy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.167.225.76] X-yoursite-MailScanner-ID: 930E849F9A75.A09FE X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: maozy.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Subject: [Qemu-devel] [PATCH] elfload: Replace malloc with g_malloc 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: pbonzini@redhat.com, peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Mao Zhongyi --- bsd-user/elfload.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 41a1309..17dfaca 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -1064,22 +1064,22 @@ static void load_symbols(struct elfhdr *hdr, int fd) =20 found: /* Now know where the strtab and symtab are. Snarf them. */ - s =3D malloc(sizeof(*s)); + s =3D g_malloc(sizeof(*s)); syms =3D malloc(symtab.sh_size); if (!syms) { - free(s); + g_free(s); return; } s->disas_strtab =3D strings =3D malloc(strtab.sh_size); if (!s->disas_strtab) { - free(s); + g_free(s); free(syms); return; } =20 lseek(fd, symtab.sh_offset, SEEK_SET); if (read(fd, syms, symtab.sh_size) !=3D symtab.sh_size) { - free(s); + g_free(s); free(syms); free(strings); return; @@ -1115,7 +1115,7 @@ static void load_symbols(struct elfhdr *hdr, int fd) many symbols we managed to discard. */ new_syms =3D realloc(syms, nsyms * sizeof(*syms)); if (new_syms =3D=3D NULL) { - free(s); + g_free(s); free(syms); free(strings); return; @@ -1126,7 +1126,7 @@ static void load_symbols(struct elfhdr *hdr, int fd) =20 lseek(fd, strtab.sh_offset, SEEK_SET); if (read(fd, strings, strtab.sh_size) !=3D strtab.sh_size) { - free(s); + g_free(s); free(syms); free(strings); return; --=20 2.7.4