Parcourir la source

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.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
(cherry picked from commit ad11ad77748bdd8016370db210751683dc038dd6)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Stefan Weil il y a 13 ans
Parent
commit
61dea8e914
1 fichiers modifiés avec 1 ajouts et 3 suppressions
  1. 1 3
      linux-user/syscall.c

+ 1 - 3
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);
         unlock_user(argptr, arg, target_size);
     }
     }
 out:
 out:
-    if (big_buf) {
-        free(big_buf);
-    }
+    g_free(big_buf);
     return ret;
     return ret;
 }
 }