diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Src/Builtins/sched.c | 2 | ||||
-rw-r--r-- | Src/Zle/complist.c | 4 | ||||
-rw-r--r-- | Src/exec.c | 4 | ||||
-rw-r--r-- | Src/sort.c | 2 | ||||
-rw-r--r-- | Src/utils.c | 6 |
6 files changed, 15 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog index 2a308a37e..fed76e508 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-11-30 Oliver Kiddle <opk@zsh.org> + + * 33818: Src/Builtins/sched.c, Src/Zle/complist.c, + Src/exec.c, Src/sort.c, Src/utils.c: fix types passed to sizeof + detected by coverity as being wrong + 2014-11-28 Barton E. Schaefer <schaefer@brasslantern.com> * 33819: Test/A06assign.ztst: regression tests for 33816 diff --git a/Src/Builtins/sched.c b/Src/Builtins/sched.c index c1cc98354..bcf7661f4 100644 --- a/Src/Builtins/sched.c +++ b/Src/Builtins/sched.c @@ -346,7 +346,7 @@ schedgetfn(UNUSED(Param pm)) for (i = 0, sch = schedcmds; sch; sch = sch->next, i++) ; - aptr = ret = zhalloc(sizeof(char **) * (i+1)); + aptr = ret = zhalloc(sizeof(char *) * (i+1)); for (sch = schedcmds; sch; sch = sch->next, aptr++) { char tbuf[40], *flagstr; time_t t; diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index 2e1a5273c..c129940f7 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -2059,8 +2059,8 @@ complistmatches(UNUSED(Hookdef dummy), Chdata dat) i = zterm_columns * listdat.nlines; free(mtab); - mtab = (Cmatch **) zalloc(i * sizeof(Cmatch **)); - memset(mtab, 0, i * sizeof(Cmatch **)); + mtab = (Cmatch **) zalloc(i * sizeof(Cmatch *)); + memset(mtab, 0, i * sizeof(Cmatch *)); free(mgtab); mgtab = (Cmgroup *) zalloc(i * sizeof(Cmgroup)); #ifdef DEBUG diff --git a/Src/exec.c b/Src/exec.c index 2b7c55f8f..a5f877191 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -2299,13 +2299,13 @@ addvars(Estate state, Wordcode pc, int addflags) continue; } if (vl) { - ptr = arr = (char **) zalloc(sizeof(char **) * + ptr = arr = (char **) zalloc(sizeof(char *) * (countlinknodes(vl) + 1)); while (nonempty(vl)) *ptr++ = ztrdup((char *) ugetnode(vl)); } else - ptr = arr = (char **) zalloc(sizeof(char **)); + ptr = arr = (char **) zalloc(sizeof(char *)); *ptr = NULL; if (xtr) { diff --git a/Src/sort.c b/Src/sort.c index 3d00bb576..92ee1c0d4 100644 --- a/Src/sort.c +++ b/Src/sort.c @@ -368,7 +368,7 @@ strmetasort(char **array, int sortwhat, int *unmetalenp) sortdir = (sortwhat & SORTIT_BACKWARDS) ? -1 : 1; sortnumeric = (sortwhat & SORTIT_NUMERICALLY) ? 1 : 0; - qsort(sortptrarr, nsort, sizeof(SortElt *), eltpcmp); + qsort(sortptrarr, nsort, sizeof(SortElt), eltpcmp); sortnumeric = oldsortnumeric; sortdir = oldsortdir; diff --git a/Src/utils.c b/Src/utils.c index 5f0c1062b..926814759 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -693,12 +693,12 @@ slashsplit(char *s) int t0; if (!*s) - return (char **) zshcalloc(sizeof(char **)); + return (char **) zshcalloc(sizeof(char *)); for (t = s, t0 = 0; *t; t++) if (*t == '/') t0++; - q = r = (char **) zalloc(sizeof(char **) * (t0 + 2)); + q = r = (char **) zalloc(sizeof(char *) * (t0 + 2)); while ((t = strchr(s, '/'))) { *q++ = ztrduppfx(s, t - s); @@ -2955,7 +2955,7 @@ colonsplit(char *s, int uniq) for (t = s, ct = 0; *t; t++) /* count number of colons */ if (*t == ':') ct++; - ptr = ret = (char **) zalloc(sizeof(char **) * (ct + 2)); + ptr = ret = (char **) zalloc(sizeof(char *) * (ct + 2)); t = s; do { |