aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorUlrich Spörlein <uqs@FreeBSD.org>2015-12-29 11:24:41 +0000
committerUlrich Spörlein <uqs@FreeBSD.org>2015-12-29 11:24:41 +0000
commitc9e1c304c1f5553fb45f2851840cb6ee6e39243f (patch)
treeb886de70650826ff015bc0343d808ffba0f524fd /usr.sbin
parente96092e82bbfbee2350ed4061ae1db9b95ef7156 (diff)
downloadsrc-c9e1c304c1f5553fb45f2851840cb6ee6e39243f.tar.gz
src-c9e1c304c1f5553fb45f2851840cb6ee6e39243f.zip
Fix type mismatches for malloc(3) and Co.
This is rather pedantic, as for most architectures it holds that sizeof(type *) == sizeof(type **) Found by: clang static analyzer Reviewed by: ed Differential Revision: https://reviews.freebsd.org/D4722
Notes
Notes: svn path=/head/; revision=292864
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mountd/mountd.c2
-rw-r--r--usr.sbin/mpsutil/mps_cmd.c2
-rw-r--r--usr.sbin/rpc.lockd/lockd.c2
-rw-r--r--usr.sbin/rpc.statd/statd.c2
-rw-r--r--usr.sbin/rtsold/rtsold.c4
5 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 649c7d5f70a6..535a3f718197 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -422,7 +422,7 @@ main(int argc, char **argv)
* list.
*/
if (nhosts == 0) {
- hosts = malloc(sizeof(char**));
+ hosts = malloc(sizeof(char *));
if (hosts == NULL)
out_of_mem();
hosts[0] = "*";
diff --git a/usr.sbin/mpsutil/mps_cmd.c b/usr.sbin/mpsutil/mps_cmd.c
index 876243f9c04c..24ed74e3e7eb 100644
--- a/usr.sbin/mpsutil/mps_cmd.c
+++ b/usr.sbin/mpsutil/mps_cmd.c
@@ -486,7 +486,7 @@ mps_firmware_get(int fd, unsigned char **firmware, bool bios)
}
size = reply.ActualImageSize;
- *firmware = calloc(1, sizeof(char) * size);
+ *firmware = calloc(1, sizeof(unsigned char) * size);
if (*firmware == NULL) {
warn("calloc");
return (-1);
diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c
index 4f1347ef924b..88b19b71e2bb 100644
--- a/usr.sbin/rpc.lockd/lockd.c
+++ b/usr.sbin/rpc.lockd/lockd.c
@@ -220,7 +220,7 @@ main(int argc, char **argv)
* list.
*/
if (nhosts == 0) {
- hosts = malloc(sizeof(char**));
+ hosts = malloc(sizeof(char *));
if (hosts == NULL)
out_of_mem();
diff --git a/usr.sbin/rpc.statd/statd.c b/usr.sbin/rpc.statd/statd.c
index faa8513ba59a..256f58dc8e37 100644
--- a/usr.sbin/rpc.statd/statd.c
+++ b/usr.sbin/rpc.statd/statd.c
@@ -150,7 +150,7 @@ main(int argc, char **argv)
* list.
*/
if (nhosts == 0) {
- hosts = malloc(sizeof(char**));
+ hosts = malloc(sizeof(char *));
if (hosts == NULL)
out_of_mem();
diff --git a/usr.sbin/rtsold/rtsold.c b/usr.sbin/rtsold/rtsold.c
index b251482fed50..1482798460df 100644
--- a/usr.sbin/rtsold/rtsold.c
+++ b/usr.sbin/rtsold/rtsold.c
@@ -888,7 +888,7 @@ autoifprobe(void)
warnmsg(LOG_WARNING, __func__,
"multiple interfaces found");
- a = (char **)realloc(argv, (n + 1) * sizeof(char **));
+ a = realloc(argv, (n + 1) * sizeof(char *));
if (a == NULL) {
warnmsg(LOG_ERR, __func__, "realloc");
exit(1);
@@ -903,7 +903,7 @@ autoifprobe(void)
}
if (n) {
- a = (char **)realloc(argv, (n + 1) * sizeof(char **));
+ a = realloc(argv, (n + 1) * sizeof(char *));
if (a == NULL) {
warnmsg(LOG_ERR, __func__, "realloc");
exit(1);