upstream: calloc can return NULL but xcalloc can't.

From Coverity CID 291881, ok djm@

OpenBSD-Commit-ID: 50204b755f66b2ec7ac3cfe379d07d85ca161d2b
This commit is contained in:
dtucker@openbsd.org 2023-03-12 09:41:18 +00:00 committed by Darren Tucker
parent 83a56a49fd
commit 8f287ba60d
No known key found for this signature in database
1 changed files with 2 additions and 2 deletions

4
sftp.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: sftp.c,v 1.228 2023/03/08 06:21:32 dtucker Exp $ */
/* $OpenBSD: sftp.c,v 1.229 2023/03/12 09:41:18 dtucker Exp $ */
/*
* Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
*
@ -1007,7 +1007,7 @@ do_globbed_ls(struct sftp_conn *conn, const char *path,
*/
for (nentries = 0; g.gl_pathv[nentries] != NULL; nentries++)
; /* count entries */
indices = calloc(nentries, sizeof(*indices));
indices = xcalloc(nentries, sizeof(*indices));
for (i = 0; i < nentries; i++)
indices[i] = i;