summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-10 18:10:36 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-10 18:10:36 +0000
commit6eb6e4600bce1a3a8127297425768f31e33b852c (patch)
treeea58243b949e73c787602af859f204c5f7b1c7a2 /sys/kern
parentb91e576ec3372d3e9f2e8ae3cf9ff56c7018d4dc (diff)
sizes for free(); ok sthen
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/exec_script.c4
-rw-r--r--sys/kern/kern_sysctl.c9
2 files changed, 7 insertions, 6 deletions
diff --git a/sys/kern/exec_script.c b/sys/kern/exec_script.c
index 461ce29007a..d99c05b1153 100644
--- a/sys/kern/exec_script.c
+++ b/sys/kern/exec_script.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_script.c,v 1.35 2015/03/14 03:38:50 jsg Exp $ */
+/* $OpenBSD: exec_script.c,v 1.36 2015/09/10 18:10:35 deraadt Exp $ */
/* $NetBSD: exec_script.c,v 1.13 1996/02/04 02:15:06 christos Exp $ */
/*
@@ -287,7 +287,7 @@ fail:
free(*tmpsap, M_EXEC, 0);
tmpsap++;
}
- free(shellargp, M_EXEC, 0);
+ free(shellargp, M_EXEC, 4 * sizeof(char *));
}
/*
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 042ce02cc61..ca2aea12544 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.290 2015/09/03 12:13:13 mpi Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.291 2015/09/10 18:10:35 deraadt Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -2151,7 +2151,7 @@ sysctl_sysvipc(int *name, u_int namelen, void *where, size_t *sizep)
#ifdef SYSVSHM
struct shm_sysctl_info *shmsi;
#endif
- size_t infosize, dssize, tsize, buflen;
+ size_t infosize, dssize, tsize, buflen, bufsiz;
int i, nds, error, ret;
void *buf;
@@ -2201,7 +2201,8 @@ sysctl_sysvipc(int *name, u_int namelen, void *where, size_t *sizep)
*sizep = 0;
return (ENOMEM);
}
- buf = malloc(min(tsize, buflen), M_TEMP, M_WAITOK|M_ZERO);
+ bufsiz = min(tsize, buflen);
+ buf = malloc(bufsiz, M_TEMP, M_WAITOK|M_ZERO);
switch (*name) {
#ifdef SYSVSEM
@@ -2252,7 +2253,7 @@ sysctl_sysvipc(int *name, u_int namelen, void *where, size_t *sizep)
}
*sizep -= buflen;
error = copyout(buf, where, *sizep);
- free(buf, M_TEMP, 0);
+ free(buf, M_TEMP, bufsiz);
/* If copyout succeeded, use return code set earlier. */
return (error ? error : ret);
}