svn commit: r339993 - head/stand/libsa

Toomas Soome tsoome at FreeBSD.org
Thu Nov 1 13:29:57 UTC 2018


Author: tsoome
Date: Thu Nov  1 13:29:55 2018
New Revision: 339993
URL: https://svnweb.freebsd.org/changeset/base/339993

Log:
  libsa: tftp should use calloc
  
  instead of malloc() memset(), use calloc().

Modified:
  head/stand/libsa/tftp.c

Modified: head/stand/libsa/tftp.c
==============================================================================
--- head/stand/libsa/tftp.c	Thu Nov  1 13:12:05 2018	(r339992)
+++ head/stand/libsa/tftp.c	Thu Nov  1 13:29:55 2018	(r339993)
@@ -448,11 +448,10 @@ tftp_open(const char *path, struct open_file *f)
 	if (is_open)
 		return (EBUSY);
 
-	tftpfile = (struct tftp_handle *) malloc(sizeof(*tftpfile));
+	tftpfile = calloc(1, sizeof(*tftpfile));
 	if (!tftpfile)
 		return (ENOMEM);
 
-	memset(tftpfile, 0, sizeof(*tftpfile));
 	tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE;
 	tftpfile->iodesc = io = socktodesc(*(int *) (f->f_devdata));
 	if (io == NULL) {


More information about the svn-src-head mailing list