linux-user: Remove redundant null check and replace free by g_free
PATCH 1/1 linux-user: Remove redundant null check and replace free by g_free
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.
--- linux-user/syscall.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
linux-user/syscall.c +1 -3
@@ -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; }
Signature · 1 line
1.7.10
Quoted 9 lines · Stefan Weil
Report from smatch:
linux-user/syscall.c:3632do_ioctl_dm(220)info:
redundant null check onbig_bufcallingfree()'
big_buf' was allocated byg_malloc0, therefore free was also replaced byg_free.Signed-off-by Stefan Weil <[email protected]>
-- PMM
Am 04.09.2012 22:14, schrieb Stefan Weil:
Quoted 18 lines
Report from smatch:
linux-user/syscall.c:3632do_ioctl_dm(220)info:
redundant null check onbig_bufcallingfree()'
big_buf' was allocated byg_malloc0, therefore free was also replaced byg_free.Signed-off-by Stefan Weil<[email protected]>--- linux-user/syscall.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)linux-user/syscall.c +0
-0
linux-user/syscall.c static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, · line 3634
Quoted 10 lines
linux-user/syscall.c +1
-3@@ -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
Stefan Hajnoczi
AppliedQuoted 5 lines · Stefan Weil
Report from smatch:
linux-user/syscall.c:3632do_ioctl_dm(220)info:
redundant null check onbig_bufcallingfree()
Quoted 7 lines
'
big_buf' was allocated byg_malloc0, therefore free was also replaced byg_free.Signed-off-by Stefan Weil <[email protected]>--- 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