Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/csh Use the right size for several calloc calls.



details:   https://anonhg.NetBSD.org/src/rev/64571944aac3
branches:  trunk
changeset: 936917:64571944aac3
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Aug 09 00:53:38 2020 +0000

description:
Use the right size for several calloc calls.

When allocating for a Char **, it should use sizeof(Char *), not
sizeof(Char **). This doesn't actually affect the results except
on DS9000 though :-)

(part 2, the instance in this file was as far as I can tell
inexplicably missed by CVS on the first go...)

diffstat:

 bin/csh/csh.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 5d313ab8f42c -r 64571944aac3 bin/csh/csh.c
--- a/bin/csh/csh.c     Sun Aug 09 00:51:12 2020 +0000
+++ b/bin/csh/csh.c     Sun Aug 09 00:53:38 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $ */
+/* $NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)csh.c      8.2 (Berkeley) 10/12/93";
 #else
-__RCSID("$NetBSD: csh.c,v 1.52 2020/08/09 00:51:12 dholland Exp $");
+__RCSID("$NetBSD: csh.c,v 1.53 2020/08/09 00:53:38 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -697,7 +697,7 @@
      * i+2 where i is the number of colons in the path. There are i+1
      * directories in the path plus we need room for a zero terminator.
      */
-    pv = xcalloc((size_t) (i + 2), sizeof(Char **));
+    pv = xcalloc((size_t) (i + 2), sizeof(*pv));
     dp = cp;
     i = 0;
     if (*dp)



Home | Main Index | Thread Index | Old Index