Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/telnet telnet(1): use reallocarr instead of malloc(x...



details:   https://anonhg.NetBSD.org/src/rev/3ce458a28c3b
branches:  trunk
changeset: 990566:3ce458a28c3b
user:      nia <nia%NetBSD.org@localhost>
date:      Sat Oct 30 11:37:18 2021 +0000

description:
telnet(1): use reallocarr instead of malloc(x * y)

diffstat:

 usr.bin/telnet/telnet.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 612abdf3cde9 -r 3ce458a28c3b usr.bin/telnet/telnet.c
--- a/usr.bin/telnet/telnet.c   Sat Oct 30 11:34:59 2021 +0000
+++ b/usr.bin/telnet/telnet.c   Sat Oct 30 11:37:18 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: telnet.c,v 1.42 2019/01/05 06:47:24 maya Exp $ */
+/*     $NetBSD: telnet.c,v 1.43 2021/10/30 11:37:18 nia Exp $  */
 
 /*
  * Copyright (c) 1988, 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)telnet.c   8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: telnet.c,v 1.42 2019/01/05 06:47:24 maya Exp $");
+__RCSID("$NetBSD: telnet.c,v 1.43 2021/10/30 11:37:18 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -578,8 +578,8 @@
        /*
         * Allocate an array to put the name pointers into
         */
-       argv = (char **)malloc((n+3)*sizeof(char *));
-       if (argv == 0)
+       argv = NULL:
+       if (reallocarr(&argv, n + 3, sizeof(char *)) != 0)
                return(unknown);
 
        /*



Home | Main Index | Thread Index | Old Index