* [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free
@ 2012-09-04 20:14 Stefan Weil
2012-09-04 20:40 ` Peter Maydell
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Weil @ 2012-09-04 20:14 UTC (permalink / raw)
To: Riku Voipio; +Cc: Stefan Weil, qemu-devel
Report from smatch:
linux-user/syscall.c:3632 do_ioctl_dm(220) info:
redundant null check on big_buf calling free()
'big_buf' was allocated by g_malloc0, therefore free was also
replaced by g_free.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
linux-user/syscall.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1513f08..c3533da 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3628,9 +3628,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
unlock_user(argptr, arg, target_size);
}
out:
- if (big_buf) {
- free(big_buf);
- }
+ g_free(big_buf);
return ret;
}
--
1.7.10
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free
2012-09-04 20:14 [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free Stefan Weil
@ 2012-09-04 20:40 ` Peter Maydell
2012-09-22 21:28 ` Stefan Weil
2012-09-23 6:35 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2012-09-04 20:40 UTC (permalink / raw)
To: Stefan Weil; +Cc: Riku Voipio, qemu-devel
On 4 September 2012 21:14, Stefan Weil <sw@weilnetz.de> wrote:
> Report from smatch:
>
> linux-user/syscall.c:3632 do_ioctl_dm(220) info:
> redundant null check on big_buf calling free()
>
> 'big_buf' was allocated by g_malloc0, therefore free was also
> replaced by g_free.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free
2012-09-04 20:14 [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free Stefan Weil
2012-09-04 20:40 ` Peter Maydell
@ 2012-09-22 21:28 ` Stefan Weil
2012-09-23 6:35 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Weil @ 2012-09-22 21:28 UTC (permalink / raw)
To: qemu-trivial; +Cc: Peter Maydell, Riku Voipio, qemu-devel
Am 04.09.2012 22:14, schrieb Stefan Weil:
> Report from smatch:
>
> linux-user/syscall.c:3632 do_ioctl_dm(220) info:
> redundant null check on big_buf calling free()
>
> 'big_buf' was allocated by g_malloc0, therefore free was also
> replaced by g_free.
>
> Signed-off-by: Stefan Weil<sw@weilnetz.de>
> ---
> linux-user/syscall.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 1513f08..c3533da 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -3628,9 +3628,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
> unlock_user(argptr, arg, target_size);
> }
> out:
> - if (big_buf) {
> - free(big_buf);
> - }
> + g_free(big_buf);
> return ret;
> }
>
Ping? Maybe qemu-trivial can take that patch, it's trivial enough.
Peter reviewed it, see http://patchwork.ozlabs.org/patch/181669/.
Regards
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free
2012-09-04 20:14 [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free Stefan Weil
2012-09-04 20:40 ` Peter Maydell
2012-09-22 21:28 ` Stefan Weil
@ 2012-09-23 6:35 ` Stefan Hajnoczi
2 siblings, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2012-09-23 6:35 UTC (permalink / raw)
To: Stefan Weil; +Cc: Riku Voipio, qemu-devel
On Tue, Sep 04, 2012 at 10:14:19PM +0200, Stefan Weil wrote:
> Report from smatch:
>
> linux-user/syscall.c:3632 do_ioctl_dm(220) info:
> redundant null check on big_buf calling free()
>
> 'big_buf' was allocated by g_malloc0, therefore free was also
> replaced by g_free.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> linux-user/syscall.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-23 6:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-04 20:14 [Qemu-devel] [PATCH] linux-user: Remove redundant null check and replace free by g_free Stefan Weil
2012-09-04 20:40 ` Peter Maydell
2012-09-22 21:28 ` Stefan Weil
2012-09-23 6:35 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).