* [Qemu-trivial] [PATCH] qga/commands-posix: Fix resource leak
@ 2015-03-14 3:30 ` Shannon Zhao
0 siblings, 0 replies; 6+ messages in thread
From: Shannon Zhao @ 2015-03-14 3:30 UTC (permalink / raw)
To: qemu-devel
Cc: peter.maydell, hangaohuai, zhang.zhanghailiang, qemu-trivial, mjt,
peter.huangpeng, shannon.zhao, pbonzini
It's detected by coverity. Close the dirfd.
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
qga/commands-posix.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index d5bb5cb..cbf1c80 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
if (local_err) {
g_free(buf);
+ close(dirfd);
error_propagate(errp, local_err);
return NULL;
}
@@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
info->size = strtol(buf, NULL, 16); /* the unit is bytes */
g_free(buf);
+ close(dirfd);
return info;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] qga/commands-posix: Fix resource leak
@ 2015-03-14 3:30 ` Shannon Zhao
0 siblings, 0 replies; 6+ messages in thread
From: Shannon Zhao @ 2015-03-14 3:30 UTC (permalink / raw)
To: qemu-devel
Cc: peter.maydell, hangaohuai, zhang.zhanghailiang, qemu-trivial, mjt,
mdroth, peter.huangpeng, shannon.zhao, pbonzini
It's detected by coverity. Close the dirfd.
Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
qga/commands-posix.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index d5bb5cb..cbf1c80 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
if (local_err) {
g_free(buf);
+ close(dirfd);
error_propagate(errp, local_err);
return NULL;
}
@@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
info->size = strtol(buf, NULL, 16); /* the unit is bytes */
g_free(buf);
+ close(dirfd);
return info;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [PATCH] qga/commands-posix: Fix resource leak
2015-03-14 3:30 ` [Qemu-devel] " Shannon Zhao
@ 2015-03-14 6:54 ` Stefan Weil
-1 siblings, 0 replies; 6+ messages in thread
From: Stefan Weil @ 2015-03-14 6:54 UTC (permalink / raw)
To: Shannon Zhao, qemu-devel
Cc: peter.maydell, hangaohuai, zhang.zhanghailiang, qemu-trivial, mjt,
peter.huangpeng, shannon.zhao, pbonzini
Am 14.03.2015 um 04:30 schrieb Shannon Zhao:
> It's detected by coverity. Close the dirfd.
>
> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
> qga/commands-posix.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index d5bb5cb..cbf1c80 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
> ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
Why not closing it here? It's no longer needed.
> if (local_err) {
> g_free(buf);
> + close(dirfd);
> error_propagate(errp, local_err);
> return NULL;
> }
> @@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
> info->size = strtol(buf, NULL, 16); /* the unit is bytes */
>
> g_free(buf);
> + close(dirfd);
>
> return info;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] qga/commands-posix: Fix resource leak
@ 2015-03-14 6:54 ` Stefan Weil
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Weil @ 2015-03-14 6:54 UTC (permalink / raw)
To: Shannon Zhao, qemu-devel
Cc: peter.maydell, hangaohuai, zhang.zhanghailiang, qemu-trivial, mjt,
mdroth, peter.huangpeng, shannon.zhao, pbonzini
Am 14.03.2015 um 04:30 schrieb Shannon Zhao:
> It's detected by coverity. Close the dirfd.
>
> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
> ---
> qga/commands-posix.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index d5bb5cb..cbf1c80 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
> ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
Why not closing it here? It's no longer needed.
> if (local_err) {
> g_free(buf);
> + close(dirfd);
> error_propagate(errp, local_err);
> return NULL;
> }
> @@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
> info->size = strtol(buf, NULL, 16); /* the unit is bytes */
>
> g_free(buf);
> + close(dirfd);
>
> return info;
> }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-trivial] [Qemu-devel] [PATCH] qga/commands-posix: Fix resource leak
2015-03-14 6:54 ` Stefan Weil
@ 2015-03-14 9:14 ` Shannon Zhao
-1 siblings, 0 replies; 6+ messages in thread
From: Shannon Zhao @ 2015-03-14 9:14 UTC (permalink / raw)
To: Stefan Weil, qemu-devel
Cc: peter.maydell, hangaohuai, zhang.zhanghailiang, qemu-trivial, mjt,
peter.huangpeng, shannon.zhao, pbonzini
On 2015/3/14 14:54, Stefan Weil wrote:
> Am 14.03.2015 um 04:30 schrieb Shannon Zhao:
>> It's detected by coverity. Close the dirfd.
>>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>> qga/commands-posix.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
>> index d5bb5cb..cbf1c80 100644
>> --- a/qga/commands-posix.c
>> +++ b/qga/commands-posix.c
>> @@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>> ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
>
> Why not closing it here? It's no longer needed.
>
Ok, will fix this.
Thanks,
Shannon
>> if (local_err) {
>> g_free(buf);
>> + close(dirfd);
>> error_propagate(errp, local_err);
>> return NULL;
>> }
>> @@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>> info->size = strtol(buf, NULL, 16); /* the unit is bytes */
>> g_free(buf);
>> + close(dirfd);
>> return info;
>> }
>
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] qga/commands-posix: Fix resource leak
@ 2015-03-14 9:14 ` Shannon Zhao
0 siblings, 0 replies; 6+ messages in thread
From: Shannon Zhao @ 2015-03-14 9:14 UTC (permalink / raw)
To: Stefan Weil, qemu-devel
Cc: peter.maydell, hangaohuai, zhang.zhanghailiang, qemu-trivial, mjt,
mdroth, peter.huangpeng, shannon.zhao, pbonzini
On 2015/3/14 14:54, Stefan Weil wrote:
> Am 14.03.2015 um 04:30 schrieb Shannon Zhao:
>> It's detected by coverity. Close the dirfd.
>>
>> Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
>> Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
>> ---
>> qga/commands-posix.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
>> index d5bb5cb..cbf1c80 100644
>> --- a/qga/commands-posix.c
>> +++ b/qga/commands-posix.c
>> @@ -2285,6 +2285,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>> ga_read_sysfs_file(dirfd, "block_size_bytes", buf, 20, &local_err);
>
> Why not closing it here? It's no longer needed.
>
Ok, will fix this.
Thanks,
Shannon
>> if (local_err) {
>> g_free(buf);
>> + close(dirfd);
>> error_propagate(errp, local_err);
>> return NULL;
>> }
>> @@ -2293,6 +2294,7 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
>> info->size = strtol(buf, NULL, 16); /* the unit is bytes */
>> g_free(buf);
>> + close(dirfd);
>> return info;
>> }
>
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-14 9:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-14 3:30 [Qemu-trivial] [PATCH] qga/commands-posix: Fix resource leak Shannon Zhao
2015-03-14 3:30 ` [Qemu-devel] " Shannon Zhao
2015-03-14 6:54 ` [Qemu-trivial] " Stefan Weil
2015-03-14 6:54 ` Stefan Weil
2015-03-14 9:14 ` [Qemu-trivial] " Shannon Zhao
2015-03-14 9:14 ` Shannon Zhao
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.