Source-Changes-HG archive

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

[src/trunk]: src/lib/libtelnet libtelnet: convert malloc(x * y) to reallocarr



details:   https://anonhg.NetBSD.org/src/rev/254b5f0ebd57
branches:  trunk
changeset: 1024633:254b5f0ebd57
user:      nia <nia%NetBSD.org@localhost>
date:      Sat Oct 30 10:46:57 2021 +0000

description:
libtelnet: convert malloc(x * y) to reallocarr

diffstat:

 lib/libtelnet/sra.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (24 lines):

diff -r 5f2841dd0d15 -r 254b5f0ebd57 lib/libtelnet/sra.c
--- a/lib/libtelnet/sra.c       Sat Oct 30 10:44:25 2021 +0000
+++ b/lib/libtelnet/sra.c       Sat Oct 30 10:46:57 2021 +0000
@@ -32,7 +32,7 @@
 #ifdef notdef
 __FBSDID("$FreeBSD: src/contrib/telnet/libtelnet/sra.c,v 1.16 2002/05/06 09:48:02 markm Exp $");
 #else
-__RCSID("$NetBSD: sra.c,v 1.11 2012/01/09 15:25:34 christos Exp $");
+__RCSID("$NetBSD: sra.c,v 1.12 2021/10/30 10:46:57 nia Exp $");
 #endif
 
 #ifdef SRA
@@ -517,9 +517,9 @@
 {
        int i;
        cred_t *cred = appdata;
-       struct pam_response *reply = malloc(sizeof(*reply) * num_msg);
+       struct pam_response *reply = NULL;
 
-       if (reply == NULL)
+       if (reallocarr(&reply, num_msg, sizeof(*reply)) != 0)
                return PAM_BUF_ERR;
 
        for (i = 0; i < num_msg; i++) {



Home | Main Index | Thread Index | Old Index