From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YXMUO-0004Y8-RK for mharc-qemu-trivial@gnu.org; Mon, 16 Mar 2015 00:18:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39758) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXMUN-0004X1-96 for qemu-trivial@nongnu.org; Mon, 16 Mar 2015 00:18:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXMUM-0001Do-Gu for qemu-trivial@nongnu.org; Mon, 16 Mar 2015 00:18:51 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:10028) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXMUH-0001DF-It; Mon, 16 Mar 2015 00:18:46 -0400 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CIN33031; Mon, 16 Mar 2015 12:17:17 +0800 (CST) Received: from [127.0.0.1] (10.177.16.142) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.158.1; Mon, 16 Mar 2015 12:17:07 +0800 Message-ID: <55065940.5090301@huawei.com> Date: Mon, 16 Mar 2015 12:17:04 +0800 From: Shannon Zhao User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Stefan Weil , References: <1426326735-11448-1-git-send-email-zhaoshenglong@huawei.com> <550405B9.4010604@weilnetz.de> In-Reply-To: <550405B9.4010604@weilnetz.de> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.16.142] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, zhang.zhanghailiang@huawei.com, qemu-trivial@nongnu.org, mjt@tls.msk.ru, peter.huangpeng@huawei.com, shannon.zhao@linaro.org, pbonzini@redhat.com Subject: Re: [Qemu-trivial] [PATCH v2] qga/commands-posix: Fix resource leak X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2015 04:18:52 -0000 On 2015/3/14 17:56, Stefan Weil wrote: > Am 14.03.2015 um 10:52 schrieb Shannon Zhao: >> It's detected by coverity. Close the dirfd. >> >> Signed-off-by: Shannon Zhao >> Signed-off-by: Shannon Zhao >> --- >> v1->v2: close after use [Stefan Weil] >> --- >> qga/commands-posix.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/qga/commands-posix.c b/qga/commands-posix.c >> index d5bb5cb..ba8de62 100644 >> --- a/qga/commands-posix.c >> +++ b/qga/commands-posix.c >> @@ -2283,6 +2283,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp) >> buf = g_malloc0(20); >> ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err); >> + close(dirfd); >> if (local_err) { >> g_free(buf); >> error_propagate(errp, local_err); > > Thanks. > > Reviewed-by: Stefan Weil > Hi Stefan, Thanks for your review. Shannon From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXMUL-0004Wu-Ir for qemu-devel@nongnu.org; Mon, 16 Mar 2015 00:18:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXMUI-0001DW-Bk for qemu-devel@nongnu.org; Mon, 16 Mar 2015 00:18:49 -0400 Message-ID: <55065940.5090301@huawei.com> Date: Mon, 16 Mar 2015 12:17:04 +0800 From: Shannon Zhao MIME-Version: 1.0 References: <1426326735-11448-1-git-send-email-zhaoshenglong@huawei.com> <550405B9.4010604@weilnetz.de> In-Reply-To: <550405B9.4010604@weilnetz.de> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] qga/commands-posix: Fix resource leak List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, hangaohuai@huawei.com, zhang.zhanghailiang@huawei.com, qemu-trivial@nongnu.org, mjt@tls.msk.ru, mdroth@linux.vnet.ibm.com, peter.huangpeng@huawei.com, shannon.zhao@linaro.org, pbonzini@redhat.com On 2015/3/14 17:56, Stefan Weil wrote: > Am 14.03.2015 um 10:52 schrieb Shannon Zhao: >> It's detected by coverity. Close the dirfd. >> >> Signed-off-by: Shannon Zhao >> Signed-off-by: Shannon Zhao >> --- >> v1->v2: close after use [Stefan Weil] >> --- >> qga/commands-posix.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/qga/commands-posix.c b/qga/commands-posix.c >> index d5bb5cb..ba8de62 100644 >> --- a/qga/commands-posix.c >> +++ b/qga/commands-posix.c >> @@ -2283,6 +2283,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp) >> buf = g_malloc0(20); >> ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err); >> + close(dirfd); >> if (local_err) { >> g_free(buf); >> error_propagate(errp, local_err); > > Thanks. > > Reviewed-by: Stefan Weil > Hi Stefan, Thanks for your review. Shannon